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
GhilliGhilli 

How to trigger an event when an attachment is added or deleted on Account

Hi All,

 

 

I have one requirement like i need to update the field 'Status'(custom field added to Account) to 'Yes' while attachment is added to the account. If no attachment is there under account the status to be changed to 'No'.

 

Kindly let me know where i need to trigger the event.

 

If we need to use Apex/VFPage, guide me to do that.

 

Thanks.

 

rcravenrcraven

Unfortunately, you cannot use a rollup summary field and workflow, because Attachments is not a master-details relationship.

 

You will need to create a after insert, after delete trigger on the Attachment object to satify this requirement.