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
franklin_atxfranklin_atx 

Mirroring Campaing Member Tables

I have several campaigns that have members flowing into them and I want to be able to mirror the membership into a master campaign (member table). Would like this to be automatic and not manually as there a many campagins that will flow into the master campaign and LEADs can come in at any time.

 

Example: Campaign A (parent) and Campaign B (child) - whenever a campaign member table entry is created for Campaign B, I want the same entry added to Campagin A. There can be many "children" campaigns that flow there members into the parent. 

 

At all times the Lead/Contact will reside in both the parent/child campaign. 

 

Any thoughts?

Thanks,

jkucerajkucera

In my opinion, creating a report to mass add members from all the child campaigns might be easier, but if you're set on automatic, an insert trigger should do the trick.  Syntax isn't perfect, but gives you a point in the right direction:

 

trigger cloneme on CampaignMember (after Insert){

  List<CampaignMember> cms=new List<CampaignMember>;

for(campaignmember cm:trigger.new){

  if (cm.campaignName='CampaignA'){

     cms.add(leadid=cm.leadid, contactid=cm.contactid, campaignid=cm.campaignid);

 }

}

try{

insert cms} catch (exception e){

}

}

franklin_atxfranklin_atx

John,

 

As of right now I have 56 "child" campaigns that I need to move their member tables into the "Parent". The "child" list could grow over time but more importantly the member table will grow daily, weekly so doing this manually could take some time. 

 

I will look at the trigger example you sent.

 

Thanks,