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
Abhay MohanAbhay Mohan 

How to apply trigger on Total Annual Revenue is not greater than 1000000 in single day

AbhinavAbhinav (Salesforce Developers) 
Hi Abhay,

Please elaborate  your questions as it seems unclear.

Thanks!
Abhay MohanAbhay Mohan
want trigger on Account, in that today's Annual revenue not exceed 1000000 (That means in single day).  if goes above then want to show error.
Abhay MohanAbhay Mohan
Hi Abhinav,

are you got my Point.. If yes Plaese go through it. 

Thanks & Regards..
 
Ashish Singh SFDCAshish Singh SFDC
Hi Abhay,

As I have understood, you basically need to prevent Opportunity Creation if Revenue limit cap for the day is exhausted.

You can start with writing before trigger on Opportunity Object. You would need before Insert and Before Update Event. Basically once Opportunity is inserted or Update you need to find out all the Opporunities that got created Today against that Opportunity and then if you find any opp with amount >=1000000, then use addError Method.

This trailhead is great way to start with your first Trigger.
 
https://trailhead.salesforce.com/en/content/learn/modules/apex_triggers/apex_triggers_intro

Let me know if you need any assistance.

Thanks & Regards,
Ashish Singh