I am writing a workflow rule to send an email to the Opportunity owner whenever an Opportunity is assigned to users under certain profiles. My workflow rule looks something like this:
Evaluation Criteria: Evaluate the rule when a record is created, and every time it's edited AND(CASE(Owner.Profile.Name, "Advisor", 1, "Super User", 1, "Assistant to Advisor", 1, 0) == 1, IsClosed = FALSE, ISNEW() || ISCHANGED(OwnerId), RecordType.DeveloperName = 'Referral' ) Immediate Workflow Action: Email Alert
In our full sandbox all the users have correct email address and email deliverability is also set to all emails because our training happens in this sandbox. Due to this, the users are getting emails of Opportunity assignment for Sandbox too and we want to avoid that. How can I use a custom setting so that only the users I specify in that if assigned as an Owner of the Opportunity should get an email.
Following workflow rule does not work because it still sending email to the owner of the Opportunity when the custom setting "Send_Email_Opportunity_Owner__c" is set to true for the running user.
AND(CASE(Owner.Profile.Name, "Advisor", 1, "Super User", 1, "Assistant to Advisor", 1, 0) == 1, IsClosed = FALSE, ISNEW() || ISCHANGED(OwnerId), $Setup.Send_Email_Opportunity_Owner__c.Allow_Email_Send__c = TRUE, RecordType.DeveloperName = 'Referral' )
Can this even be done?