You need to sign in to do that
Don't have an account?
Chris Chahinian
Apex trigger: Update Lead Source from Custom Contact Lookup Field to Opportunity
Hi,
On Opportunities, l have a custom field called ‘Primary_Contact_Name__c’, this is a Lookup related to Contacts.
When the Primary_Contact_Name__c field is entered on an Opportunity (mandatory field) and saved, I need the Lead Source from this Primary_Contact_Name__c Contact Reord to update the Opportunity Lead Source field.
I still want to give the user the option to select a Lead Source on the Opportunity, but when they hit save, if a Lead Source already exists on the Primary_Contact_Name__c, l want it to be overridden.
If the Lead Source on the Contact is empty, l need the Opportunity Lead source the user selected to remain, and update the Lead Source on the Primary_Contact_Name__c Contact record.
I need this trigger to run ONLY when the Opportunity is first created. Once a Lead Source has been set on both Contact & Opportunities, l want it to remain for ever.
Is this possbile? Thanks
On Opportunities, l have a custom field called ‘Primary_Contact_Name__c’, this is a Lookup related to Contacts.
When the Primary_Contact_Name__c field is entered on an Opportunity (mandatory field) and saved, I need the Lead Source from this Primary_Contact_Name__c Contact Reord to update the Opportunity Lead Source field.
I still want to give the user the option to select a Lead Source on the Opportunity, but when they hit save, if a Lead Source already exists on the Primary_Contact_Name__c, l want it to be overridden.
If the Lead Source on the Contact is empty, l need the Opportunity Lead source the user selected to remain, and update the Lead Source on the Primary_Contact_Name__c Contact record.
I need this trigger to run ONLY when the Opportunity is first created. Once a Lead Source has been set on both Contact & Opportunities, l want it to remain for ever.
Is this possbile? Thanks
http://stackoverflow.com/questions/13715218/salesforce-com-trigger-copy-contact-lead-source-to-opportunity