SOLVED

Re: Locate Campaign Member ID in SFDC

Go to solution
JimmySpencer_
Level 1 - Champion

Locate Campaign Member ID in SFDC

We are attempting to assign campaign members and their associated campaign statuses to campaigns within SFDC.

 

We're looking for the campaign member ID because this is a requirement for the API call to succeed. Sort of a chicken or egg dilemma. How do we send a campaign member ID for a record that is not associated with the SFDC campaign yet?

 

This leads me to believe this is two-step process where an ID gets generated first and then we can make the update. Anyone have experience they can share?

--Just a guy who knows enough to get into trouble--
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Locate Campaign Member ID in SFDC


The crazy part, it would seem, is that the upsert function for campaign members requires this campaign member ID. So I don't understand how that is ever usable for a new campaign member.

The upsert() function does require the CM ID for records that already exist, which means it functions somewhat differently from, say,a MERGE insert in SQL Server.

 

Since you need to know which people you’ll be updating in advance, it’s not an intelligent upsert, but more of a “bundle insert calls and update calls in one request” feature.

 

You can’t avoid querying for existing Campaign Members to get their IDs.

View solution in original post

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Locate Campaign Member ID in SFDC

As you seem to have already figured out, this is a pretty strange request!

 

You can’t know the Campaign Member ID before someone is a member of a Campaign — that’s impossible. The Campaign Member is a junction object. The creation of that object is the only way a person is added to a Campaign!

 

So let’s take a step back. We may have a significant XY Problem. What are the requirements you’re trying to meet? Please be as detailed as possible. Don’t think about “what is the Campaign Member ID” but about your true goals.

JimmySpencer_
Level 1 - Champion

Re: Locate Campaign Member ID in SFDC

Hey Sanford,

 

So desired outcomes would be for a Marketo record that is synced to SFDC (custom integration):

  • If contact is not a member of SFDC campaign X, insert as a campaign member
  • If contact is already a member of SFDC campaign X (or after they have been added) update SFDC campaign member status
    • Note: We have no concern for the the campaign status. We only care about the campaign member status (which aligns with marketo program statuses).

We have data for ContactID, CampaignID, and various attributes, but are missing this "Id" which for this sobject seems to be the campaign member ID. Chicken and egg, no Id exists for an insert. 

 

Currently we are attempting to do all of this in a single job. My assumption is that this must be a two-part process where we

  1.  create a campaign member sans campaign status, and then
  2. run a subsequent job(s) to collect the campaign member ID from SFDC and then perform a campaign member status update based on Marketo program status.  

The crazy part, it would seem, is that the upsert function for campaign members requires this campaign member ID. So I don't understand how that is ever usable for a new campaign member.

--Just a guy who knows enough to get into trouble--
SanfordWhiteman
Level 10 - Community Moderator

Re: Locate Campaign Member ID in SFDC


The crazy part, it would seem, is that the upsert function for campaign members requires this campaign member ID. So I don't understand how that is ever usable for a new campaign member.

The upsert() function does require the CM ID for records that already exist, which means it functions somewhat differently from, say,a MERGE insert in SQL Server.

 

Since you need to know which people you’ll be updating in advance, it’s not an intelligent upsert, but more of a “bundle insert calls and update calls in one request” feature.

 

You can’t avoid querying for existing Campaign Members to get their IDs.