You need to sign in to do that
Don't have an account?
Corie Dahlke
Need help creating a simple trigger on the Opportunity object.
I have two custom fields on the Opportunity object, a text field and a lookup field. The text field gets populated from an outside source and I want to populate the contents of text field and have it display in the lookup field.
I need help to create a simple trigger for this on the Opportunity object.
**Opportunity object**
text field - Discount_Code__c
lookup field - Discount_code_LU__c
Basic logic would be "Discount_Code_LU__c = Discount_Code__c"
I need help to create a simple trigger for this on the Opportunity object.
**Opportunity object**
text field - Discount_Code__c
lookup field - Discount_code_LU__c
Basic logic would be "Discount_Code_LU__c = Discount_Code__c"
Try replacing your trigger with following code.
I hope this helps.
Thanks
Arshad
All Answers
Is the Discount_Code__c field is marked External ID or unique,
Let me know so that I can share the code snippet, built accordingly.
Thanks
Arshad
Please use below code, it should work.
Please mark this as BEST ANSWER if it helps you!
sObject type 'Discount_Code__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Hello Corie,
Which sObject, is the field Discount_code_LU__c on opportunity is related To.
Thanks
Arshad
This is what our API WSDL shows. Let me know if you need any other info.
<element name="Discount_code_LU__c" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="Discount_code_LU__r" nillable="true" minOccurs="0" type="ens:Product2"/>
Try replacing your trigger with following code.
I hope this helps.
Thanks
Arshad