SOLVED

Re: How to check a lead exists or not

Go to solution
Anonymous
Not applicable

How to check a lead exists or not

Hi,

Am developing a windows service in C# .net, to update the Unsubscribe status of each leads in marketo from our database. So for that before updating the status i want to make sure that particular lead exists in Marketo. Can anyone suggest , how can i do that...?

Thanks

Jay

1 ACCEPTED SOLUTION

Accepted Solutions
Kenny_Elkington
Marketo Employee

Re: How to check a lead exists or not

The simplest way to do this is to check with Get Lead By Filter Type. Set you filterType to email, and put up to 300 email values in filterValues.  Be sure included the unsubscribed field in your return fields.

View solution in original post

10 REPLIES 10
Anonymous
Not applicable

Re: How to check a lead exists or not

see developers.marketo.com

Kenny_Elkington
Marketo Employee

Re: How to check a lead exists or not

The simplest way to do this is to check with Get Lead By Filter Type. Set you filterType to email, and put up to 300 email values in filterValues.  Be sure included the unsubscribed field in your return fields.

Anonymous
Not applicable

Re: How to check a lead exists or not

Hi Jayanth

I agree with Kenny.

but I come up with an another way.

If you specify "action" parameter "updateonly" at Update leads API, non exist user won't be created.

Of cause this way is not before updating and i don't know which way is efficient.

Create/Update Leads » Marketo Developers

Kenny_Elkington
Marketo Employee

Re: How to check a lead exists or not

This can be more efficient in certain cases, but becomes problematic if you are using email as your lookupField and there are potential duplicates.  In the case of a dupe on email address, updateOnly will skip update because of an ambiguous key and will not return the IDs you need to perform subsequent updates.  Retrieving the records first will give you the IDs you need to make unambiguous updates.  Depending on the number of dupes in your system, and whether you're going for maximum speed or minimum API calls your answer will be different.

Anonymous
Not applicable

Re: How to check a lead exists or not

Thanks guys, your solutions are working for me. I got the Leads by Get Lead By Filter Type

And after that am updating the "unsubscribe" status using this method  Create/Update Leads » Marketo Developers

but am getting a message like below

"{\"requestId\":\"6699#14f460e8f8c\",\"result\":[{\"status\":\"skipped\",\"reasons\":[{\"code\":\"1010\",\"message\":\"Partition update not allowed\"}]}],\"success\":true}"

Our Marketo Instance has partions, When i made the request i passed the partitionname as "Default", even if i did not pass the partitionname its giving the same message . Anyone knows whats causing this..? and any idea how to fix this. ?

Thanks is advance

Anonymous
Not applicable

Re: How to check a lead exists or not

Get Multiple Leads by Filter Type » Marketo Developers ​returns the leads across all partitions.

And unfortunately we can not know the partition in which the lead is.

i think your request tries to update the lead in other partition.

Anonymous
Not applicable

Re: How to check a lead exists or not

So we wont be able to do the update if partitions is there in the marketo instance ?

if possible, how we will update  ?

Anonymous
Not applicable

Re: How to check a lead exists or not

If you specify the partition name at Create/Update Leads » Marketo Developers​ ,you can update.

partitionName

Optional (but required if partitions are set up in your Marketo instance)

Lead partition name. If the instance has lead partitions set up, you need to specify the partitionName when you do an upsert call.

This is not useful.

Anyway, I found similar issue Re: Rest API, Lead Partitions, and Error on Update Lead

Kenny_Elkington
Marketo Employee

Re: How to check a lead exists or not

This isn't quite accurate and I need to update the documentation.  partitionName is only required on insert to a non-default partition, but this error is returned if the lead is in a partition which the API user cannot access(based on their role) when trying to perform an update.  In this case, if you user can access all partitions, do not pass a partitionName and you can perform the update.

Let me know if you need clarification.