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
Manish Anand 10Manish Anand 10 

Create maximum of 3 opportunities for an account object in a day.

Requirement is- To create a maximum of 3 opportunities, for an account object in a single day.
E.g- User creating 4th opportunity for the same account , in the same day when 1st, 2nd and 3rd opportunities are created, should throw an error.
E.g-If 2 opportunities are created for an account and user trying to import 3 opportunities for the same account, then 1 opportunity should be created and for rest 2, it should throw error.
SalesFORCE_enFORCErSalesFORCE_enFORCEr
You have to write a trigger on after insert, after delete of Opportunity and calculate the count of Opportunities created on the related account today and then throw an error if that count is >3