You need to sign in to do that
Don't have an account?
Cloning CampaignMembers
According to the documentation,
CampaignId field on campaignmember record, is not updatable, its only createable.
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_campaignmember.htm
How would I then copy to a table and then append versus update?
I'm trying this, but getting an error:
List<CampaignMember> Members = [SELECT id, contactid,status from CampaignMember where campaignid = :camp.id ];
// Change campaign ids to the newly cloned campaign id
// This loop below gives me error msg: Field is not writeable: CampaignMember.CampaignId
for(CampaignMember m : members){
m.Campaignid = Newcamp1.id;
}
// Update the database
insert members;
thanks, Michele
CampaignMember serves as a junction between leads/contacts and campaigns. If you just want to clone the campaign members, you should do something like this. If you are trying to reparent them, it looks like you cannot so you should just clone them and then delete the old ones.