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
vasu sfdc_21vasu sfdc_21 

trigger with apex class close date opportunity

Hi Folks,

I'm stuck in below requirement.Getting error because of process builder and validation rule and it's not working. Can we do by apex class and trigger with custom lable or what is the best way. please help me out ..

Task:  
System automation to prevent early stage opportunities with unrealistic, near term close dates. 

Ask:
For early stage pipeline opportunities, automatically push the close date to align to ‘healthy’ pipeline metrics:  

30% - Expressed Interest >45d, 
20% - Solution Identified >60d; 
10% - Discovery >75d; 
1% - New >90d

Autoclose:
Last modified Date >60 days
Stage Duration >120 days 

If a user tries to save an opportunity that violates these guidelines, display a message that lists the close date expectations and directs them to contact sales ops if an override is needed. 


Thanks !!
 
PriyaPriya (Salesforce Developers) 

Hi Vishal,

Can you please elaborate your requirement ?

Also have you tried this with any code? If yes please provide it.

Let us know what error you got.

Regards,

Priya Ranjan