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.

2 Answers 2

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

3
  • Thank you for the sanity check. Wish this would've thought about checking this earlier.
    – Minutiae
    Nov 5, 2014 at 20:40
  • ok. Workbench is my first tool for this type of clarity
    – dacology
    Nov 5, 2014 at 20:48
  • +1 for image that looks like a tear out of a book May 22, 2019 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .