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
fredkafredka 

Trigger to Count Attachments

Does anyone have a sample trigger that counts attachments that they could share? 

 

Thanks!!!

 

Fred

Ispita_NavatarIspita_Navatar

One cannot write trigger on the "notes and Attachment" object as salesforce has not exposed them for trigger manipulation. do you want to want to calculate just the number of attachment per record or you want to store the count too somewhere after calculation?

In either case an invivble vf page on the layout could do the needful.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

fredkafredka

I need to find out how many attachments are on each record... I am making some changes to my structure and merging two objects together.... I want to make sure that I move all of the attachments to the new record... Any help is appreciated!!!

 

Fred

STSSTS

Hi,

 

  can i have the trigger to count the number of attachments on a record. And can i display this count in any custom field on the same Object or a parent object. I need to get the latest attachments on a record.

 

Thanks in advance

fredkafredka

Thanks for responding!!!  I want to write the number of attachments to another field on the record.  What I really want to do is set up a requirement that certain attachments are on the group before allowing a submission.  Perhaps a VF page with a section for each required attachment would work.? thanks!!

 

Fred

PG1978PG1978

I also have to do something similiar where i need to find attachments on a particular case record. is there any out of box functionalities or do i need to write a Trigger to Count Attachments?