How do I require a user to complete opportunity contact role? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Stephanie BrownStephanie Brown 

How do I require a user to complete opportunity contact role?

I'm trying to create a validation rule to require users to provide contact roles before changing opportunities to a particular stage. Is this possible?
Best Answer chosen by Stephanie Brown
Steve MolisSteve Molis
Oksy, then you could use Process Builder or Lightning Flow to udpate a hidden field, like a Checkbox on the Opportunity when the Contact Role record is created, then your Opportunity Validation Rule would be something like this
AND(
Has_Contact_Role__c = FALSE,
CASE( StageName , 
"Prospecting",1, 
"Qualification",2, 
"Needs Analysis",3, 
"Value Proposition",4, 
"Id. Decision Makers",5, 
"Perception Analysis",6, 
"Proposal/Price Quote",7, 
"Negotiation/Review",8, 
"Closed Won",9, 
0) >= 3
)

This would make the Contact Role required at "Needs Analysis" Stage and anything after

All Answers

Krishna DadiKrishna Dadi
HI Stephanie Brown ,

You have to do little customization, as you cannot directly achieve with OOB.
You have to create a Custom Rollup summary and if rollup counts < 1 then throw the error message. 


 
Tony TrinhTony Trinh
Hi Stephanie,

Do you only require only a Primary Contact on the Opportunity? If so, you can use a validation rule like so:
AND(
ISBLANK(ContactId),
TEXT(StageName) = "Particular Stage"
)
Stephanie BrownStephanie Brown
Hi Krishna,

I tried that, but the count didn't change once I added a role. And there is no option to count the Opp Contact Role object.
Stephanie BrownStephanie Brown
Hi Tony,
Thanks, but no, all Contacts must have a Contact Role.
Steve MolisSteve Molis
On my org I created a custom Lookup(Contact) field on the Opportunity object, I use a Ligthing Flow to create a Contact Role record using the Contact ID and Opportunity Id.  I alsohave Flow that updates the Opportunity Primary Contact if it changes

Then Ibuilt a Validation Rule like this 
 
AND(
ISBLANK( Primary_Contact__c ),
CASE( StageName , 
"Prospecting",1, 
"Qualification",2, 
"Needs Analysis",3, 
"Value Proposition",4, 
"Id. Decision Makers",5, 
"Perception Analysis",6, 
"Proposal/Price Quote",7, 
"Negotiation/Review",8, 
"Closed Won",9, 
0) >= 3
)

 
Stephanie BrownStephanie Brown
Hi Steve,
Not sure I'm understanding this. I don't want to create Contact Roles automatically. I want users to create them. If they try to move an opp to a specific stage, they should get an error if there are no Contact Roles attached to the opp. It seems so straightforward, but I can't figure it out.
Steve MolisSteve Molis
Oksy, then you could use Process Builder or Lightning Flow to udpate a hidden field, like a Checkbox on the Opportunity when the Contact Role record is created, then your Opportunity Validation Rule would be something like this
AND(
Has_Contact_Role__c = FALSE,
CASE( StageName , 
"Prospecting",1, 
"Qualification",2, 
"Needs Analysis",3, 
"Value Proposition",4, 
"Id. Decision Makers",5, 
"Perception Analysis",6, 
"Proposal/Price Quote",7, 
"Negotiation/Review",8, 
"Closed Won",9, 
0) >= 3
)

This would make the Contact Role required at "Needs Analysis" Stage and anything after
This was selected as the best answer
Tony TrinhTony Trinh
Hi Stephanie,

When you select a Primary Contact in your OCRs, a field on your Opportunity "ContactId" gets populated with that ID. You can enforce the Role to be populated with a validation rule on the OCR object:
ISBLANK(TEXT(Role))
Or do you mean each Opp needs to have 1 Decision Maker, 1 Technical Buyer, etc?
Stephanie BrownStephanie Brown
This worked perfectly! Thank you!
Stephanie BrownStephanie Brown
Steve,

Follow-up question: what happens in the off chance somebody deletes a contact role after reaching a specified stage? Say the contact leaves the company. I'm trying to imagine all possible scenarios.
Stephanie BrownStephanie Brown
Tony,

That would then require me to force users to select Primary. If there's only one contact role, they might not be inclined to do that because it's assumed that person is primary.