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
Georgy PeshkovGeorgy Peshkov 

How do I make a process builder rule triggered by adding oppty contact role.

Hi all.

We need to set up a rule which woul be triggered by adding\changin opportunity contact roles to the opportunity. Now I've set up a rule that is triggered by any change on the opportunity that runs a flow. This flow checks the oppty contact roles and adds the contact role data on the oppty level.
Now it's not very convenient and occasionally causes an "Apex CPU limit exceeeded error", so I'd want to narrow that filter a little bit.
How can I trigger the rule particularly by creating\changing opportunity contact role?
Best Answer chosen by Georgy Peshkov
VineetKumarVineetKumar
I'm not sure if are that much in cutomization. But you can refer the below post, where the action of updating the opportunityContactRole was captured by the use of inline VF page and Apex Controller.

https://developer.salesforce.com/forums/?id=906F00000008vxnIAA

Since, OpportunityContactRole is a junction object, trigger is not possible on it, neither does it come while setting up the process builder.
Above is the only trick possible.

Let me know if that helped.

All Answers

VineetKumarVineetKumar
Set the rule criteria set something like :
Select > Formula Evaluates to true > ISCHANGED(FieldName) 
Georgy PeshkovGeorgy Peshkov
VineetKumar, it's a bit more complicated than that, as Opportunity Contact role is not a field on the opportunity level.
It's a different object related to opportunity.
VineetKumarVineetKumar
I'm aware of that, fieldName will be some kind of flag that says that the contact role has been modified
By creating or updating opportunity contact role you mean adding and removing the value?
Georgy PeshkovGeorgy Peshkov
Yes, by creating or updating oppty contact role I mean that the user adds a new contact role to the opportunity, or removes\changes the existing value.
How can I create a field that reacts on contact role change, that you mention?
VineetKumarVineetKumar
I'm not sure if are that much in cutomization. But you can refer the below post, where the action of updating the opportunityContactRole was captured by the use of inline VF page and Apex Controller.

https://developer.salesforce.com/forums/?id=906F00000008vxnIAA

Since, OpportunityContactRole is a junction object, trigger is not possible on it, neither does it come while setting up the process builder.
Above is the only trick possible.

Let me know if that helped.
This was selected as the best answer
Georgy PeshkovGeorgy Peshkov
Thank you!
I've no experience with Apex to use your advice bu need to start gaining some :)