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
VASCOdevVASCOdev 

Link lead to a campaign on Lead creation via API web service

At the moment, the only way I found out in order to create a lead and link it to a campaign in SalesForce via the API web service, is to first create the lead, and then create a campaignMember object which I link to the created lead (campaign id + lead id).

 

Question: is there a way to push the lead with the linked campaign all at the same time?

AlwaysConfusedAlwaysConfused

 

 

Simple answer ... No (at least i don't think so).

 

As i understand it you need to create a Lead object and insert that, then create a campaign member object and insert that.

Whilst they are related there appears to be no direct "relationship field" defined on the Lead object else you could do it by inserting the lead with the relationship value defined.

 

Having said that, try it most relationships are called something like "OtherObject__r" which means in your case if it can be done it's likely to be defined as "Campaign_Member__r" on the lead object.

 

If you get an error when defining that field, chances are you're back to making 2 calls.

 

Anyone else out there know any better?????

Feel free to correct me!!!

 

Carl HermanCarl Herman
Hi AlwaysConfused and VASCOdev, did you ever find a better answer to this question?
Thanks!