Skip to main content

Using Zapier + Salesforce, I am trying to return a list of all users created within the last 60 days, every time the Zap is run.

I attempted to use the “Find Record(s)” Event for the Salesforce Action:

I proceeded to appropriately configure the Action to reference the “User” object, and set the “Field to Search By” to “CreatedDate”:

However, I want my “Search value” to be any date that is greater than today minus 60 days. From the looks of this, is seems that the “Search value” field is restricted to only a single value. Well, it does mention that it supports line-items and comma-separated, but as you can see the actual value for that field in Salesforce is a timestamp down to the second. Obviously, it makes no sense to load in a list of values that represent every separate second between {{zap_menta_human_now}} and that minus 60 days.

A very simple SOQL query would solve for this beautifully. BUT, of course, it looks like when you use Zapier’s “Find Record by Query” Search Event, it does not support line-items (it only returns the first result in the response). 

My other attempt was to maybe somehow skip the predefined drop-down list within the “Field to Search By” box:

… and somehow write a custom field in a way that would pass into the request passing into Salesforce. 

… Or perhaps the same idea, but using the Custom option in “Search Results” Zapier field (for where you otherwise choose from the drop-down: “first” or “all” results).

… and no luck.

My backup method is to run a Google Sheets extension that is able to automatically pull rows into the sheet on a schedule, defined by a SOQL query. Then, I’m able to have Zapier “Get Many Spreadsheet Rows,” which is all just incredible sloppy. It seems to just completely defeat the purpose of Zapier for our business (at least for how I pitched to our stakeholders the benefits of incorporating Zapier into our corporate stack).

Anything else I am missing? Would love any help that the community here has to offer.

 

For what it’s worth, it is completely unfeasible to instead run a query that simply retrieves ALL salesforce users, and then filter the results in Zapier based on each record’s CreatedDate. That is a very simple worst practice re: payload issues.

 

Thanks in advance to everyone who took the time to read through this!

Hi @Woo at SpotOn 

Good question.

Often advanced logic will require using an app API.

Salesforce API: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm

Zap Action: Salesforce - API Request

If you need help consider hiring a Certified Zapier Expert: https://zapier.com/experts/automation-ace

 


@Woo at SpotOn 

Another issue with trying to retrieve multiple records is that the query could (in theory) return 1,000s of records.

Then you get into having to deal with pagination, data payload size constraints, etc.


This ended up being a really easy fix (see image below). If anyone else is trying to do anything similar with Salesforce and you are comfortable with SOQL, you might not even want to waste your time with any of the pre-built zaps…

As @Troy Tessalone mentioned, use the “API Request (Beta)”. Use the GET method with the appropriate API URL based on your instance’s API version, and then toss in the very simple parameter, “q”. The value is quite simply exactly how you would otherwise write up an SOQL query.

Keep in mind 2000 results load limitation of SOQL itself too. You may want to write in something for LIMIT at the end of your SOQL.

Best of luck!

 


Hi @Woo at SpotOn,

Awesome! Glad to know you were able to get it sorted! Also, thank you for sharing the solution. It will be helpful for our other wonderful Community members who might run into a similar issue.

If you have any other questions, please don’t hesitate to reach out. We’re always happy to help! 😊