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
yusuke nakayamayusuke nakayama 

How do I link Lead and Campaign?

I would like to extract Lead and Campaign data from salesforce via SOAP API and utilize it for our lead and campaign analysis.

I am planning to retrieve each data and load into our DB seperately and conduct 'join' the both data within our DB.
At that point, I am wondering if I can link the Lead and Campaign...So I would love to know whether there is a field that enable me to link those data.

As far as I saw the Salesforce lead window, it can include campaign history, so I thought that using CampaignHistory would be the solution.
But It seems like there are no key fields to link Lead and Campaign in either objects after reading these references.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_campaignhistory.htm
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_lead.htm

Does anyone know how to do that?
Any information would be helpful for me only if I can link those data.

Thank you.

Yusuke
Best Answer chosen by yusuke nakayama
Arpit Jain7Arpit Jain7
Hi Yusuke,

Campaign Member is the object salesforce used for linking Lead and Campaign. You can use this object in SAOP API for linking Campaign with Lead.

Below is link for Campaign Member data model which would help you with more details

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_campaignmember.htm

Hope this helps !!

Thanks
Arpit

All Answers

Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Yusuke,

Quick Find > Leads > Page Layout > Edit whichever layout you are adding campaigns to > Related List > then you added the Campaign History to the Layout then saved? hope it helps.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar
yusuke nakayamayusuke nakayama
Hi Rahul,

Thank you for your advice.

I can already see Campaign History at the Lead page.(Other employee has already set the layout)

My question might be confusing, sorry.

The question is how I can retrieve the field which link lead and campaign via API. I would like to use SOAP API and it seems there are no fields that can relate lead to campaign or vice versa, although I can confirm related campaign history on Lead page on Salesforce.
Are there any fields like lead id in the Campaign History Object? or any fields like campaign id in Lead Object?

I hope this clarify my question.

Thank you.

Yusuke
Arpit Jain7Arpit Jain7
Hi Yusuke,

Campaign Member is the object salesforce used for linking Lead and Campaign. You can use this object in SAOP API for linking Campaign with Lead.

Below is link for Campaign Member data model which would help you with more details

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_campaignmember.htm

Hope this helps !!

Thanks
Arpit
This was selected as the best answer
yusuke nakayamayusuke nakayama
Arpit

Thank you for your advice!

I will see it and try extracting data using it :)
Thank you!

Yusuke
yusuke nakayamayusuke nakayama
Hi Arpit,

I've just confirmed that CampaignMember works fine :)
Thank you for your help and time!

Yusuke