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
Frank BassilloFrank Bassillo 

Way to make sure Account Managers attach necessary documents?

Hey Everyone,

I was just wondering if anyone knew of a way to make it sure Account Managers attach any required documents once an oppotunity is changed to "closed"

I figured I could just create a process to send out an email alert, but I was wondering if anyone knew of any more effective methods.


Akhil TandonAkhil Tandon
Hi Frank,
You can add trigger to validate presence of attachments before closing the opportunity.
Below is a sample code.

trigger tgrOpportunity on Opportunity (before update) 
    List<Opportunity> lstOpp = [select id,(select id from Attachments) from Opportunity where id in : Trigger.New];
    for(Opportunity o : lstOpp)
        if(Trigger.NewMap.get( && o.Attachments.size() ==0)
            Trigger.NewMap.get('Please add an attachment before closing the opportunity.');

Please mark this as best answer if this helps.

Akhil Tandon