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
David BudimirDavid Budimir 

Restrict number of Opportunities where "Opt Out" field Is true - Per Sales Rep

Hi all, hoping to get some help to solve this.  :)

We identfy deals that that have an opt out clause with a checkbox in opportunities. However we want to prevent our sales reps from offering a certain number of opt out deals in a certian period (ex. 2 per month).

Is there a way to create a validation rule that counts the number of open "opt out" opportunities (for a specific opportunity owner) that produces an error when they try to go beyond that threshold?

In other words - how can I have a rule that counts the number of times Opt-Out = True for a specific user. Thanks!
@anilbathula@@anilbathula@
Hi David budmir,

You need to write trigger a trigger for this task.
Standard validation rule wont work here.

Thanks
Anil.B

 
David BudimirDavid Budimir
@anilbathula@ Thanks - So I'll create a trigger each time that field is true. How can I get that trigger to update the count of another field? Thanks!