[SalesForce] Auto create campaign member

I need to create a campaign member based off of a custom field value on the lead object. I'm a newbie to the world of apex but hopefully this will better help me understand the process.

When

Custom_Field__c = My New Campaign

CREATE
———– >>> New campaign member of campaign (My New Campaign)

Any help would be greatly appreciated.

Best Answer

This is job for trigger! :) As you are newbie I will give you some tips to show you way, but details you should find by yourself ;)

So, create trigger for lead - best idea should be after insert/update: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers.htm

In trigger create new instance of campaignMember (fill all required fields based on your lead) http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_campaignmember.htm

then insert your instance of campaignMember and enjoy your new campaignMember :D

To be honest I think this question is not specific enough and could be easly close. So try follow steps I described and in case of any errors or problems please ask again. The forum is place where you could find help with your problems - not someone who make your job.

Related Topic