Re: sync only existing lead

Anonymous
Not applicable

sync only existing lead

Hi guys,
Thank you for quick response for my recent topics!

Today I'm looking for optimized way to sync only existing leads. SyncLead also adds a new lead, but I dont want to create a new one.
I can use two requests - first, call getLead and only if it returns something, then call syncLead, but it means doubling requests.

Is there smarter solution?


Tags (1)
7 REPLIES 7
Anonymous
Not applicable

Re: sync only existing lead

One option is a combination of getMultipleLeads + syncMultipleLeads which will handle 100 leads per single API call.

The other option is getLeadChanges +  syncMultipleLeads. It also packs 100 leads per single API call.

getLeadChanges checks for changes that have occurred to leads and lead history. 
The changes reported include new leads created, leads updated with the changed fields, and new activity records for leads. The result contains activities that caused the change.
Anonymous
Not applicable

Re: sync only existing lead

my goal is to populate custom fields in lead, but I dont need to create a new lead if it does not exist.
today, when I call syncLead, it creates a new lead and that's what I need to prevent, I still dont understand how the suggested solution may help.
I would use syncLeadwith a flag upsert=false, that's what i'm looking for.
Anonymous
Not applicable

Re: sync only existing lead

I may be misunderstanding the context. Please apologise if I am not following your idea correctly.

If you use getMultipleLeads or getLeadChanges, populate or update fields and then send back through syncMultipleLeads no new lead will be created because SOAP API will always find a matching email address, unless you are changing the email address as well. In that case you would use IDNUM as lead key.
Anonymous
Not applicable

Re: sync only existing lead

i dont getLeads before updating. I'm calling syncLead and using marketoCookie in ParamsSyncLead for lead identification, but sometimes the lead does not exist yet means I'm I'm trying to update not existing lead and as a result syncLead creates it which is undesired
Anonymous
Not applicable

Re: sync only existing lead

I have to admit I am not following you at all. We are looking the same idea from totally different perspectives.
 
The original post was "looking for optimized way to sync only existing leads". 
 
In the last update you mentioned "I dont getLeads before updating. I'm calling syncLead and using marketoCookie in ParamsSyncLead for lead identification."
 
When I read "looking for optimized way to sync only existing leads" I interpret as "update attributes of existing leads, do not create any new lead". I would use getMultipleLeads or getLeadChanges, uptade all relevant attributes and then syncMultipleLeads based on lead key IDNUM. 
 
Anonymous
Not applicable

Re: sync only existing lead

I have marketoCookie as an input, but not the lead object and I need to check whether there a lead with such marketoCookie and udate it if exists.
for that I call syncLead with leadKey=marketoCookie
the problem is syncLead creates a new lead if it is not found by sent marketoCookie and this is what do I need to prevent - if lead does not exist, dont create it.
I dont need to call getLead/getMultipleLeads and then syncLead, the api allows to update lead by leadKey by sending fields to be updated without fetching the lead. 
I want to prevent the call checking if lead exists.
Anonymous
Not applicable

Re: sync only existing lead

Hi Alexey - 

syncLead does an upsert  when called. If the lead does not exisit, it will create a new lead.

Like my colleague mentioned and what you have noted in your first post - You will need to run a getLead call prior to the syncLead call to check if the lead exisit, sync it if it is already in Marketo, or do nothing if it returns no lead. 

There is also a flaw with the logic that you are proposing. Say for example If I as a lead happen to clear out my cookies. You will effectively not have any data from me moving forward; since no lead will have the new cookie value, and never be created.