Help with a flow that updates lookup field on opportunity with Primary Contact from Contact Roles - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
James BensonJames Benson 

Help with a flow that updates lookup field on opportunity with Primary Contact from Contact Roles

In this success community answer, they found the solution but I'm stuck on the {!varOpportunityID} part.

I'm not sure what I should configure that variable with. 

User-added image

Any help would be appreciated!

James
Best Answer chosen by James Benson

All Answers

Om PrakashOm Prakash
In this case varOpportunityID will be marked as input variable, and you need to pass this value from Process builder when your flow will be called
James BensonJames Benson
Om.

I apologize for my denseness on this - I'm very new to flows. When I create that variable, what do I configure it with?

James
James BensonJames Benson
Forgot to link the success community answer I was referring to: 


https://success.salesforce.com/answers?id=9063A000000e4QeQAI
Om PrakashOm Prakash
Got it.
You want to update a custom lookup Contact fields’s value on Opportunity Record from primary contact role.
This will happen whenever any field on Opportunity will be updated and value of primary contact will be null on Opportunity.

When you will create this variable then only need to mark "Available for input" as checked.
User-added image

Please give it a try and mean while I am also sharing you complete steps so you can revisit the same
James BensonJames Benson
Worked like a Charm, thank you Om!!!!
Om PrakashOm Prakash
Awesome! You are welcome.
James BensonJames Benson
Om,

Quick question. Is there a way to make the primary contact field on the opportunity update if the primary contact changes in the contact roles? Right now once that value populates it doesn't change.

Does that make sense?

Thank you!
James
Om PrakashOm Prakash
Hi James,
1.  You want that every time Opportunity record  get updated then we check that If primary contact role have  been changed, then update the newly contact id on Opportunity.
>
if yes, then simply remove the criteria  “Contact is  null” from process builder so it will call the flow after every changes on Opportunity.
Flow will pull latest primary contact every time. 
(Here we  should add a condition check in Flow before updating Opportunity that if previous contact id on Opportunity and current primary contact role’s Contact id is different then only update Opportunity record.).

2. If you want that whenever primary contact role get changed on Opportunity, newly Contact id get populated on Opporrunity.
>
I afraid If this real time could achieved as we can’t define OpportunityContactRole in process builder.
I found this idea is in under product team review to allow Process Builder support on OpportunityContactRole:
https://success.salesforce.com/ideaView?id=08730000000DpQGAA0