You need to sign in to do that
Don't have an account?
Elsa Cordonnier
Custom Object <> Opportunity Trigger
Hello,
I need help and advise to build a smal trigger on a Custom Object to push some information on the Opportunity, the mentionned object don't have any Master relationship with the Opportunity.
My Object is called: Consumer_Order__c
I need to push the information only if the order_type__c (Picklist) is "Compensation Credit"
My aim, is to push in the Opportunity 2 information when the Object is created.
- First the Net_Price__c (Currency)
- Second the Compensation_credit_reasons__c (Picklist)
The two fields I have to update in the Opportunity are:
- Consumer_Compensation_credit__c (Currency)
- Consumer_Compensation_credit_reasons__c (Text)
Can you help me building this simple Trigger ?
Thank you in advance
I need help and advise to build a smal trigger on a Custom Object to push some information on the Opportunity, the mentionned object don't have any Master relationship with the Opportunity.
My Object is called: Consumer_Order__c
I need to push the information only if the order_type__c (Picklist) is "Compensation Credit"
My aim, is to push in the Opportunity 2 information when the Object is created.
- First the Net_Price__c (Currency)
- Second the Compensation_credit_reasons__c (Picklist)
The two fields I have to update in the Opportunity are:
- Consumer_Compensation_credit__c (Currency)
- Consumer_Compensation_credit_reasons__c (Text)
Can you help me building this simple Trigger ?
Thank you in advance
I assume the Consumer_Order__c has a Lookup field to the Opportunity (say the field name is Opportunity__c). You can easily use the Process Builder to do this.
- Create a new Process Builder
- Select Consumer_Order__c as the main object
- For the criteria, you can add the Order_Type__c field = Compensation Credit
- For the action, select Update Records, and select the Opportunity
However, if you still want to use a trigger, here is a quick code: