You need to sign in to do that
Don't have an account?
mat_tone_84
work on campaignmember with trigger
I have to update a custom field of contact if the field status of campaignmember change.
How can I fire on campaignmember with a trigger?
I need a trigger like this:
trigger trigger1 on CampaignMember(after update) { join contact with campaignmember by id.... and then contact.custom_field__c = campaignmember.status }
thanks
Currently, triggers are not allowed on second class objects (junction objects) like Campaign Member. I believe that Salesforce is exploring this functionality in a future release. Vote up the idea here:
Allow Apex triggers on junction tables like CampaignMember
All Answers
Currently, triggers are not allowed on second class objects (junction objects) like Campaign Member. I believe that Salesforce is exploring this functionality in a future release. Vote up the idea here:
Allow Apex triggers on junction tables like CampaignMember
We've heard your votes and Campaign Member triggers are going live with Summer '09. To do a field update on another object, you can create the custom field and then use code something like the below. This updates the custom field "Campaign.Last_RSVP_Yes_Time__c" on Campaign when one of it's Campaign Members status changes to RSVP-Yes.
You can change Campaign to Contact and tweak the code to meet your needs. Make sure you include a check for whether the CM is a contact or lead or you'll get some exceptions thrown.