+ Start a Discussion

Encountered a problem when working with OpportunityContactRoles

I wrote a trigger on Opportunity that takes values from custom fields and makes them into the primaryContactRole for the Opporunity being created or updated.


This is working well but I relized that if a user went down into the OpporutnityConactRoles list view, they would be able to change the primary contact and my custom fields that drive the trigger would be left un updated.


If there anyway that I can monitor changes made to the OpportunityContactRole list and fire updates based off this?


A solution that doesnt require visualforce gets bonus points!


Hengky IlawanHengky Ilawan

Hi BerettaJon,


I am afraid there is no trigger for OpportunityContactRole object that you can use to prevent the changes.

But however, you can write a logic to validate the list or alert the user for example, when the opp is marked as closed won, or any condition that you prefer.