Skip to main content
Best answer

Salesforce sandbox connection: find Record(s) by Query returning too many resullts

  • July 24, 2025
  • 5 replies
  • 24 views

I’m using sandbox connection.

My search query is Processing_time_in_days__c = null AND (Status = 'New' OR Status = 'In progress')

I select the option “Return first search result” but the test still returns thousands of records, so I cannot send the fields to open AI to analyze (too many characters, and Open AI has a limit).

Why is it happening?

Best answer by SamB

Sorry to hear you’re getting a “MALFORMED_QUERY” error with that approach ​@Mikey Long! I had a closer look into this and it appears there’s actually two very similar actions for searching Salesforce by query:

4f92c9e362bcd5d9a7a26bcb912380f5.png
The Find Record by Query action has a field that looks like it should allow you to set the maximum number of records that are returned:

2e4d08cf5c7c090d149289ceb58b4df4.png
Can you try setting that field to 1 and let us know whether that does the trick?

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 9736 replies
  • July 24, 2025

Hi ​@Mikey Long 👋

It sounds like the query is overriding the “Return first search result” setting. I’d recommend flagging that with our Support Team in case it’s a bug:  https://zapier.com/app/get-help

In the meantime, you can try reducing the number of results returned by adding a LIMIT clause to your query. For example you’d want something more like:

SELECT Processing_time_in_days__c, Status
FROM YOUR_OBJECT_API_NAME_GOES_HERE__c
WHERE Processing_time_in_days__c = null
AND (Status = 'New' OR Status = 'In progress')
LIMIT 1

Give that a try and let me know how it goes! 🙂


  • Author
  • Beginner
  • 3 replies
  • July 24, 2025

I added Limit 1 to the query and Zap returns an error message 😭

Failed to find a record in Salesforce

Salesforce returned a MALFORMED_QUERY error. Please make sure you are entering valid data or use the help link below to contact Zapier support for more information / assistance.


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 9736 replies
  • Answer
  • July 25, 2025

Sorry to hear you’re getting a “MALFORMED_QUERY” error with that approach ​@Mikey Long! I had a closer look into this and it appears there’s actually two very similar actions for searching Salesforce by query:

4f92c9e362bcd5d9a7a26bcb912380f5.png
The Find Record by Query action has a field that looks like it should allow you to set the maximum number of records that are returned:

2e4d08cf5c7c090d149289ceb58b4df4.png
Can you try setting that field to 1 and let us know whether that does the trick?


  • Author
  • Beginner
  • 3 replies
  • July 25, 2025

You are right, when I use a different action Find record (singular) I can enter the maximum number. Thanks a lot, now I can use it for the next steps.


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 9736 replies
  • July 28, 2025

That’s great news, ​@Mikey Long! 🎉 I’m so pleased that other search action did the trick. Do reach back out if you run into any trouble setting up the next steps in your Zap. In the meantime, happy Zapping! 😁⚡