How to retrieve leads based on a custom field?

Anonymous
Not applicable

How to retrieve leads based on a custom field?

I have a requirement to query all the leads based on a custom field.
Say, I have a custom field "IsValid" of type boolean.
I need to retrieve all the leads with "IsValid = true" using SOAP API.
Is there a way to do this ?

Thank You

Tags (1)
7 REPLIES 7
Anonymous
Not applicable

Re: How to retrieve leads based on a custom field?

You can't specify filter params via API but you can create & maintain a list in Marketo that contains the leads you are interested in.  Then you can make use of the GetMultipleLeads API call and specify that list.
Anonymous
Not applicable

Re: How to retrieve leads based on a custom field?

I created a smart list to filter the leads.
But I am unable to retrieve using the smart list.
Any Ideas ?
Anonymous
Not applicable

Re: How to retrieve leads based on a custom field?

Static (not smart) lists are supported.
Anonymous
Not applicable

Re: How to retrieve leads based on a custom field?

So, is it like the leads should be manually added to the list via the UI ?
Or is there any way to periodically move the leads to this list based on criteria ?
Please let me know.
Anonymous
Not applicable

Re: How to retrieve leads based on a custom field?

You can create smart campaigns in Marketo to add/remove leads from the list.

Other Option depending on your use case:
The other option is to make periodic calls to getMultipleLeads passing in a watermark timestamp (i.e. date/time since last run).  This will return all leads that were created or had any field value changes made to them.

Then your code would iterate over these leads and check the IsValid value to get the leads you are interested in.

Depends on your use case of if you want to get a list of all leads that are currently set to IsValid or if you are looking for leads that have changed their status to IsValid so that you can process them.
Anonymous
Not applicable

Re: How to retrieve leads based on a custom field?

Thanks Angelo.

Overall I am thinking of the below solution.

1. Create a smart campaign which runs daily to move the leads with "IsValid=false" to a static list.
2. Using soap api, I retrieve the leads from the static list, process them and update the leads with IsValid=false.
3. Create another smart campaign which runs daily to remove the leads with "IsValid=true" from the same static list.

Please let me know if this would be an ideal solution.
Are there any situations where you foresee that any limits getting exceeded ?
Or any other suggestions ?

Thanks
Anonymous
Not applicable

Re: How to retrieve leads based on a custom field?

I think you meant in (1) to move leads with "IsValid=true" to static list and in (3) to remove the leads with "IsValid = false"

If so, yes, that should work

As mentioned above, the other option is to make a GetMultipleLeads call passing in the lastModifiedDate.