Getting the number of leads in a Smart View for each User in a Group individually
Some teams in Close treat the number of leads in particular Smart Views as metrics they'd like to track and report on. Here are some use cases:
- Leads that were created this month and assigned to me
- Leads that I moved into a particular status
- Leads that are assigned to me and "rotting"
In cases where you want to automate the reporting of this data, rather than going in and running the Smart View as each individual user, you can set up a zap that handles all that for you.
What you will need
- A Zapier account that supports multi-step zaps
- A group or groups in Close (Enterprise plan is required)
- Close API key - available at
Settings > API Keys
- Your Close Organization ID (we can provide you with this ID if you do not have it)
Setting up the Zap
Instead of creating this Zap from scratch, we have a pre-built template for you ready to go. All you need to do is fill in a few things and you'll be up and running.
Use the template
Step 1 - Schedule by Zapier
This is an optional trigger, but the most popular choice and what we'll use in this example. We're going to set up a weekly zap that generates some metrics for users in our Sales Team and Success Team groups.
First, we'll use the
Schedule by Zapier trigger and say we want this zap to trigger weekly - by default on Sunday Noon.
Once this is configured, we can move to the next step.
Step 2 - Code by Zapier
This next step is going to gather all of the users in your Close groups, and run any subsequent step as each user in that group.
To do this, we've already pre-populated this step with all the code that you'll need so you just need to configure 3 input data fields. Your values (the right side) should be as follows:
api_key- Your Close API Key that is available in Close under Settings > API Keys
group_names- Groups you want to use as they appear under Close Settings > Team Management > Groups
organization_id- Your Close organization ID. If you don't have the ID yet, please reach to [email protected] and we'll send it to you.
Once this is done, test the step. Your output should be one of the users in the listed groups, along with additional information about the user, such as email address and phone number.
It's important to understand the impact of this step on your zapier tasks, and it will essentially multiple your subsequent task steps and the number of users in your groups. For example, if there are 10 users in your groups, and 10 steps in the zap to gather various metrics, this zap will fire 100 tasks each time it runs.
Step 3 - Find Number of Leads in Query
For this example, we're going to show you how to set the zap up to pull the number of leads in a particular Smart View.
Let's say I want to have this report on the "number of new leads created last week that were assigned to me."
To do this, we'll use the
Find Number of Leads in Query action in Close.
When prompted to enter the query, you will want to select
Custom, as we will need to enter the search query directly into Zapier for this zap.
Once you enter your search query, you'll want to swap out any references to a Username with the output from the code step. This will ensure that each subsequent time the zap runs, it's inserting each username dynamically into the queries to pull the data you need.
When setting up these zaps, you'll want to make sure there's not a possibility of new data being added after you run the zap. Because of this, you'll want to set up your queries to reference past dates. For example, choose "last week", "last month", "yesterday" instead of "this week", "this month", or "today".
Step 4 - Create Spreadsheet Row in Google Sheets
Once you've set up and tested any subsequent steps, you'll be all set! The most popular final step would be to add a row containing all of the data points to a Google Sheet using the
Create Spreadsheet Row action.