function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rachel LinderRachel Linder 

Apex Trigger Error "Error: Compile Error: expecting a semi-colon, found 'opptyIds' at line 15 column 12"

I have the following trigger written to check a box on the opportunity if the opportunity has attachments. When trying to save the trigger I am getting the following error:

User-added image
Not sure what it is asking me to do.
venkat-Dvenkat-D
You have to define set like this

Set<ID> oppsIds  = new set<Ids>();
 
Vijay NagarathinamVijay Nagarathinam
HI,

In your code, Line number 15 change the code below like this,

Set<Id> opptyIds = new Set<Id>();

Let me know if you need any help regarding this.

Thanks,
Vijay
Rachel LinderRachel Linder

Hi Vijay,
Any help would be appreciated. I am not a dveloper and I am trying to write this on my own. I am trying to write a trigger that looks at notes and attachments to see if there are any attachments. If there are then I want it to put a check in the "Has Attachments" checkbox. I made the change you stated above but it gives me yet another error. Maybe I need to start over.
Thanks.

R-

venkat-Dvenkat-D
Hi Rachel, You cant do attachments checkbox with trigger on Opportunity. You need to write trigger on Attachment object.

Refer to below post for your use case.  Replace custom object with Opportunity


https://developer.salesforce.com/forums/?id=906F00000008mUNIAY