When I'm going to create a campaign response entity, I need to add a party list attribute, the key for this attribute is "campaignresponse_activity_parties" in the API.
This old code explain what I want to do:
Entity party1 = new Entity("activityparty");
party1["addressused"] = email;
party1["partyid"] = new EntityReference("lead", lead.Id);
EntityCollection partyList = new EntityCollection();
partyList.Entities.Add(party1);
campaignResponse["customer"] = partyList;
I tried some ways around the internet like this, but unsuccessfully, I'm not given an error when creating the campaign response, but the party list field is not added to the campaign response entity record.
My current code is something like this:
JObject party1 = new JObject();
party1["addressused"] = email;
party1["partyid_lead@odata.bind"] = "/leads(" + lead.Id.ToString() + ")";
JArray partyList = new JArray();
partyList.Add(party1);
campaignResponses["campaignresponse_activity_parties"] = partyList;
If there's anything that I forgot to do, please let me know.
You have to add participationtypemask
as well. I’m not quite sure on number (11 or 4) and I’m answering without testing this code from my mobile right now.
JObject party1 = new JObject();
party1["addressused"] = email;
party1["partyid_lead@odata.bind"] = "/leads(" + lead.Id.ToString() + ")";
party1["participationtypemask"] = 11;
JArray partyList = new JArray();
partyList.Add(party1);
campaignResponses["campaignresponse_activity_parties"] = partyList;