2

Can anybody help me figure out why Salesforce is saying the Campaign Member ContactId field is not writeable?

I have Dedupe logic that runs on Contact after insertion, if it matches an existing Lead, any Campaign Member associated to the Lead is reparented to the new Contact.

The Campaign Member is queried via SOQL, and the ContactId is populated with the newly created Contact.Id, and the LeadId is nulled out.

This code was working fine up until this morning it seems.

6

The contactId field on the Campaign member is not updateable. I don't think this has changed recently. You can check this yourself on your own org with the use of the workbench(enter link description here) connect the work bench to your org then view the standard object metadata for CampaignMember.

enter image description here

| improve this answer | |
  • Thank you for the sanity check. Wish this would've thought about checking this earlier. – Minutiae Nov 5 '14 at 20:40
  • ok. Workbench is my first tool for this type of clarity – dacology Nov 5 '14 at 20:48
  • +1 for image that looks like a tear out of a book – Scott Pelak May 22 '19 at 18:24
1

We can just clone the campaign member we want and reassign required lead or contact Id to it.

for(CampaignMember m : list_cmp){
       CampaignMember campMemb = m.clone(false, true);
        campMemb.LeadId =l.Id;
       lstCampMember.add(campMemb);
       insert lstCampMember;          
    }

Go throught this link for example :https://developer.salesforce.com/forums/?id=906F000000094FXIAY

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.