function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
t anthonyt anthony 

Campaign Member tableI

Is there a way to create a workflow action or trigger on the Campaign members / Member status?

We need to capture updates to the campaign member status but I am not sure if we can fire off any workflow or database triggers when a contact is assigned to a campaign or the campaign member status for that member is updated.



BairdBaird
Exactly my problem.  I'm trying to find some Apex code that solves it.  Let me know if you come on any solutions.
mat_tone_84mat_tone_84

Did you find the way ?

 

I have the same problem

jkucerajkucera

With Summer '09, both workflow and triggers will be available for Campaign Member.  Here's a trigger example of a cross object field update to Campaign to keep a running count of the RSVP's for an event campaign:

 

trigger UpdateCmpRegistered on CampaignMember (before update) {

    Campaign c = [select Id,Registered__c, name from Campaign where Id = :Trigger.new[0].CampaignId limit 1];

   

    for(CampaignMember cm : Trigger.new){

        if (cm.Status == 'RSVP-Yes') {

          if (c.Registered__c== null) {

              c.Registered__c=0;

              }

          c.Registered__c += 1;

        }

     }

   

    update(c);

}

 

 

Note this isn't bulkified and should have more error handling in practice, but is intended as a proof of concept.  look for this to be live in all production orgs mid June.