私はApex Developmentの新機能です。私は私のApex TriggerのためのTestClassを書いています。アップデートのためのApexトリガーのテストクラス
私はあなたと私のコードを共有しています:
trigger ClosedOpportunityTrigger on Opportunity (before update) {
for(Opportunity o:Trigger.New) {
if(o.Probability==100 && o.Invoiced__c == true)
{
Attachment a = new Attachment();
try {
a = [Select Id, Name from Attachment where ParentId =:o.Id];
}
catch(Exception e) {
a = null;
}
if (a == null)
o.addError('Add an attachment before you close the Opportunity');
}
}
}
こんにちはTim、私はエラーが発生しました: "エラー:コンパイルエラー:予期しないトークン 'void'。行2の列15 \t" –
ありがとう、私はいくつかの変更を行ったし、うまく機能していた –
それはロジックそれの後ろに、あなたのトリガーのキャッチブロックに欠陥があると言って、最後に私のメモを見てもらいたいと思います –