+ Start a Discussion
Khemais MenzliKhemais Menzli 

How to add a trigger on object OpportunityContactRoles

I start working with SFDC's triggers since a little bit, what I noticed that triggers on object OpportunityContactRoles are not allowed, are there any way to use fire a trigger when an end-user add a contact to an opportunity.My requirement, is to catch the event when an end-user attach a contact to a given opportunity, thenbased on the data in the contact itself I'll update some properties in the opportunities.
Any help is appreciated  
sfdcsushilsfdcsushil
Hello, Couple of solutions possible - 

1. Asyncronous - Write a batch apex which runs every hour or every day once to fetch all newly created oppcontactrole records and do any processing. 
2. Syncronous - Use custom object to achieve similar functionality as provided by oppContactRole(Not recomended)
3. Syncrhonous2 - Inline VF page on opportunity.

Also take a look at below discussion thread - 
https://developer.salesforce.com/forums/?id=906F00000008vxnIAA

Promote this idea

https://success.salesforce.com/ideaview?id=08730000000BrdvAAC