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
Adhvika BalaAdhvika Bala 

Autolaunched flow to Create related records

I'have created the following auto launched flow to create Opportunity Contact role based on primary contact look up field.
User-added imageAnd using process builder to call this flow everytime when an opportunity is created or edited.
User-added image
How ever its creating the same Opportunity contact role record multiple times(everytime when the opportunity is created or edited).
If i change the criteria in the process builder as 'only when a record is created' it creates the oppty contact role only when a new opportunity is created.
It doesn't create it when the primary contact look up value is changed .
Any suggestions on how we can avoid this duplicate creations.
Please advise.
David Zhu 🔥David Zhu 🔥
You may add a second criteria by chekcing Opportunity.Primary_Contact__c is changed, trigger the same flow if the value is TRUE.
User-added image
 
Adhvika BalaAdhvika Bala
Tried to use that filter criteria.
User-added image

Still it creates duplicate records during when i edit and save the opportunity.
David Zhu 🔥David Zhu 🔥
You may expand "Advanced" at the bottom of the screen and check "Yes".
Adhvika BalaAdhvika Bala
Updated it. But getting this error.User-added image