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
PDXMarinerFanPDXMarinerFan 

Count Number of Attachments?

Has anyone figured out how to create a custom formula that will count the number of attachments?  Actually, it needs to be part of a validation rule.  "If Opportunity Stage = 'xxx', then the record must have one attachment."

 

Is this possible without APEX\VF?

Best Answer chosen by Admin (Salesforce Developers) 
MarkSilberMarkSilber
Unfortunately it's not possible without an Apex Trigger. You can't create workflow or validation rules on Attachments and you can't do a roll-up summary field either.

All Answers

MarkSilberMarkSilber
Unfortunately it's not possible without an Apex Trigger. You can't create workflow or validation rules on Attachments and you can't do a roll-up summary field either.
This was selected as the best answer
PDXMarinerFanPDXMarinerFan
thanks, that is what I was afraid of
Deepak PansariDeepak Pansari

But how do I can countattachment via "Trigger”, as when I attached any file to Opportunity, Opportunity does not get modify and result trigger doesnot get fire.

 

Any thought on this orany solution for counting an attachment to Opportunity.

 

--Deepak  

 

MarkSilberMarkSilber
Your trigger will need to be on the Attachment object, not Opportunity. When the trigger fires, you will need to query its parent object to determine if it's an opportunity.
Deepak PansariDeepak Pansari

Thanks for reply!!!

 

But how i can get Option to add Trigger in Attachment Object?

 

I mean in SF.com in which tab or link i can get this.

 

 

MarkSilberMarkSilber
You can only add/modify triggers for system objects via Eclipse, not directly in Salesforce.