You need to sign in to do that
Don't have an account?

how validate if exist attachment?
Hi All,
I need create a validation to check if exist attachments in the opportunity.
Someone know if is possible to do that?
I need create something like that:
If Probability is = 75% , verify if exist at least 1 file attached in the opportunity, before the user proceed to the next stage.
Thanks
Rafael
I need create a validation to check if exist attachments in the opportunity.
Someone know if is possible to do that?
I need create something like that:
If Probability is = 75% , verify if exist at least 1 file attached in the opportunity, before the user proceed to the next stage.
Thanks
Rafael
These are the steps you can follow: (It can look like a lot but would work for sure)
1) First create a field named total_attachments__c on an Opportunity Object.
2) Go to Developer Console -> File --> New --> Apex Trigger.
3) Name it CountAttachOnOpp and choose SObject as Attachment
4) Now you will see the trigger got created with few lines of code. Get rid of those few lines of code and Copy and paste the below code.
5) 6) Now, create a validation rule on opportunity object with below formula:
You are good to go!!
Thanks for your help
The Code that you works perfectly fine in the sandbox. Can you help with the test classes?