Best answer

Found Multiple Records in a Salesforce Object, how do I filter out the one I need?

  • 28 March 2022
  • 5 replies
  • 448 views

Userlevel 1

I am using the newly available Find Record(s) in Salesforce.  The result I get are multiple related records related to the same Account (that is my search criteria).  Now I want to grab just one of those related records based on a “filter” to then use later in the Zap.  

How do I “filter” out the one related record?  When I try to use “filter” it is evaluating all of the Related Records at once vs one at a time - if that makes sense?  

Any help would be much appreciated!  

icon

Best answer by Troy Tessalone 30 March 2022, 23:11

View original

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

Userlevel 7
Badge +14

Hi @montuckyMike 

Good question.

Try using the Looping app to handle array line items: https://zapier.com/apps/looping/help

Userlevel 1

Thank you @Troy Tessalone  - the Looping won’t work for me as a Loop has to be at the end of the Zap.  This is in the middle.  Maybe a Path with a loop would work?  I will have to try.  That way I could Loop every record through the Path - if it meets the Criteria I want aka Path A it does XYZ.  If it does not met the Criteria then maybe I just end Path B in a trivial way.  Check a box or something that does not matter? 

Userlevel 7
Badge +14

@montuckyMike 

You can use Filter steps within a Loop.

(Paths have to be at the end of a Zap.)

 

Looping app help article: https://zapier.com/help/create/other-functions/loop-your-zap-actions

 

How do I stop a loop from running in subsequent action steps?

All actions after the looping step will run for each iteration of the loop. If you don’t want an action step to loop:

  • After the last step you want to loop, add a filter step.
  • Set the filter to only continue if the value loop_iteration_is_last matches the (Boolean) Is True condition.

The filter will run in every loop but will only pass in the last loop. Any actions step after the filter will run once in the last loop and use only 1 task.

Note

If you want an action step to only run once, add it before the looping step, if possible. This will use less tasks and the filter step won’t be needed.

 

Userlevel 1

Pretty sure I got it to work!  

  • New Record (trigger)
  • Find Record(s)
  • Loop
    • Filter (to filter out the one I want) 
    • Create Record (using the one that started the Zap and the one I filtered out) 
Userlevel 7
Badge +9

Yay! Love to hear it, @montuckyMike! Thanks for sharing your solution with the community. 🤗