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
NMNM 

How can I write a trigger on OpportunityPartner Object ???

Hi,
I need to populate a field value when a new Opportunity Patrner is created.
How can I use a trigger on this event?
When I use the following code, I get an error message:
ErrorError: Compile Error: SObject type does not allow triggers: OpportunityPartner at line 1 column 34

trigger GetPrimaryPartnerName on OpportunityPartner (after insert) {

Opportunity[] currOppt = trigger.new;

Account[] Accnt;

OpportunityPartner[] OppPartner;


OppPartner = [select AccountToId from OpportunityPartner where OpportunityId = :currOppt[0].Id AND IsPrimary = true];

Accnt = [select Id, Name from Account where Id = :OppPartner[0].AccountToId];

currOppt[0].Partner_Name__c = Accnt[0].Name;

}

 

Is there a solution for that?

Thank you,

Noa.