Skip to main content
January 22, 2013
Question

How to retrieve leads based on a custom field?

  • January 22, 2013
  • 7 replies
  • 1534 views
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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

7 replies

January 22, 2013
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.
January 23, 2013
I created a smart list to filter the leads.
But I am unable to retrieve using the smart list.
Any Ideas ?
January 23, 2013
Static (not smart) lists are supported.
January 23, 2013
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.
January 23, 2013
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.
January 25, 2013
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
January 25, 2013
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.