web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / For each loop with get...
Power Automate
Unanswered

For each loop with get records is ignoring the filter query I have in my trigger condition

(0) ShareShare
ReportReport
Posted on by 12

I am new to power automate but I am trying to use the salesforce connector to pull multiple pieces of data from projects my team is working on each time they make an update in salesforce. I have a filter query in the trigger condition that occurs when a record is modified that filters to only occur when the local sales manager is who I choose.

( EX: Local_Sales_Manager__c eq 'John Smith').

 

I need to pull data from more than one object in salesforce so I am using the Get Records action to do this for the two other object places I need. Using these makes a for each loop when the dynamic content is added into the excel sheet.

 

When I attempt to run the filter becomes ignored when the for each loop/ Get Records is being used. The filter works as intended when no additional filters are called using Get Records. Am I misunderstanding the Get Records or is there a way to make the filter still apply or appl a filter to the Get Records also.

 

Thank you!

Categories:
I have the same question (0)
  • wskinnermctc Profile Picture
    6,519 Moderator on at

    Can you show a screenshot of your Salesforce actions? I'm trying to see what you used in the individual steps.

     

    Can you explain more about "When I attempt to run the filter becomes ignored when the for each loop/ Get Records is being used."

     

    Are you are saying that a Filter (what filter?) is being ignored when an Apply to Each step is added to the flow?

     

    Can you explain more about "The filter works as intended when no additional filters are called using Get Records."

    I don't understand what filter works as intended when no other filters are called?

  • InternChristian Profile Picture
    12 on at

    I have come to realize that each get records needs its own filter query. This is the filter I was talking about that works when I am not pulling any information besides from the oracle quote object 

    InternChristian_0-1689174180123.png

    My goal is to pull the information from opportunity and oracle quote line items for ONLY the particular oracle quote that is being updated. Because currently I think the get records is pulling from all records causing it to either not work or place projects in my excel sheet not from my team. I have been adjusting my actions steps so dont really have anything thats sticking. Here is an example of one of them: 

    InternChristian_1-1689174469154.png

    edit: I have changed filter query to cafsl__Opportunity__c and still not working.

    I think I can create a dynamic filter using data pulled from "When a oracle quote is modified" in later Get records/ record actions but can not figure out how. I appreciate the response.

     

  • Verified answer
    wskinnermctc Profile Picture
    6,519 Moderator on at

    Ok, I have never used the Salesforce connector. But I do think we can take steps to get your Filter Query working. I would do that by checking the outputs of the data and checking the column names. 

     

    So currently this is your flow:

    1. Trigger - When a Record is Modified
      • Filter Query - Local_Sales_Manager__c eq 'PersonName'
    2. Get Records - Opportunities
    3. Get Records - Oracle Quotes

     

    I would add a compose step to the flow after the initial trigger, and put the dynamic content from the trigger (Opportunities) into the compose step.

    So you should have:

    1. Trigger - When a Record is Modified
      • Filter Query - Local_Sales_Manager__c eq 'PersonName'
    2. Compose
      • Put the Opportunities Dynamic Content from the trigger in this compose.
    3. Get Records - Opportunities
    4. Get Records - Oracle Quotes

    Then run the flow.

     

    When you look at the results of the flow you are looking for 2 things.

    First: Look at the result of the Compose. This will show you what the output of that Opportunities looks like. So you will know if it is a string, number, and whatever is being pulled for that data.

     

    Second: Look at the outputs of the two Get Records. You want to see the specific column names as well as the data that is returned. The specific column name should show you how to type the name in the Filter Query of the Get Records.

    So if the output of Get Records: Opportunities shows the column as "cafsl_Opportunity_c": "OP1234" then you can copy and paste the column name cafsl_Opportunity_c and then put that into the Filter Query of Get Records: Opportunities. You also know that the data itself is a string. 

    However, if the output shows "cafsl_Opportunity_c": 1234 then you know the type of data is an integer and you would not use the single quotes ' around your dynamic content in the Filter Query.

     

    Do you think you can try that or something along those lines? We are basically trying to get the Filter Query for the Get Records: Opportunities to work correctly. And to do that we have to run tests to see what the data is supposed to look like.

  • InternChristian Profile Picture
    12 on at

    Thank you! Just to expand for others looking, I found objects that pulled the same data for Opportunity and for Oracle Quotes. These have different names but can be used as a way to make sure the filter query only filters for the same project.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard