Find Leads by Custom Field Value

November 22, 2014 | by

Let’s say you want to get leads from the Marketo API who match certain activity or inactivity criteria. For example, maybe you want to find leads whose score has not changed in the past 30 days. By following the steps in this post, you will be able to get this list of leads.

To do this, we will create a smart campaign in Marketo that identifies leads whose score has not changed in the past 30 days, and then store a value on these leads to identify them. We will then query the API with this value.

Step One: Create a new custom field called customLeadStatus

Login to Marketo, and go to the Admin panel. Click on Field Management.

Blog1

Click New Custom Field.

Blog2

Name the field. Then click Create.

Blog3

Step Two: Create a smart campaign with a smart list that looks for leads that have not been updated in 30 days.

Click New Smart Campaign.

Blog4

Name the new smart campaign.

Blog5

Drag Not Score Was Changed from right panel to middle panel.

Blog6

Step Three: Add a flow step to the smart campaign from Step 3 to update customLeadStatus field with a new value.

Drag Change Data Value from right panel to middle panel.

Blog7

Step Four: Update Smart Campaign to allow leads to run through multiple times.

Click Schedule. Then click Edit.

Blog8

Select every time. Then click Save.

Blog9

The campaign will now start running.

Blog10

Step Five: Query the Get Multiple Leads by Filter Type REST API. Providing the parameters filterType=customLeadStatus & filterValue=needsEnrichment.

This is an example request that will return this data.

A successful API call will return JSON data with leads whose customLeadStatus field matches the value of needsEnrichment.

Blog11

Please review the the Get Multiple Leads by Filter Type REST API for more information.