Skip to main content

Notifications

Create Power Automate cloud flows
Unanswered

Issue with Multiple Conditions in "Filter Array" Action

Posted on by 6
I’ve encountered an issue when trying to filter out certain accounts using multiple conditions in the "Filter Array" action. Below are the details of the flow:
 
  1. Action: Send HTTP Request to Microsoft Graph API
Retrieves a list of users with their usernames and password change dates using the following URI:
https://graph.microsoft.com/v1.0/users?$select=userPrincipalName,displayName,lastPasswordChangeDateTime
  1. Action: Parse JSON
This processes the response from the HTTP request.
  1. Action: Filter Array
I am attempting to exclude specific accounts from the list by using the following expression:

@and(
  not(equals(item()?['userPrincipalName'], '****@****.**')),
  not(equals(item()?['userPrincipalName'], '******@****.**')),
  not(equals(item()?['userPrincipalName'], '*****@****.**'))
)
 
Issue: The filter only seems to apply the condition from the last query, and as a result, it is not correctly excluding all of the specified email accounts.

Could you provide assistance on how to properly filter multiple queries within the "Filter Array" action, or let me know if there is a known issue with this functionality?
 
 
 
Categories:
  • abm abm Profile Picture
    abm abm 32,188 on at
    Issue with Multiple Conditions in "Filter Array" Action
    Hi

    try this
     
    @and(
      or(
      not(equals(item()?['userPrincipalName'], 'user1@example.com')),
      not(equals(item()?['userPrincipalName'], 'user2@example.com')),
      not(equals(item()?['userPrincipalName'], 'user3@example.com'))
      )
    )
     
    You could try one at a time and see if that works. Then extend it.
  • bakerhija Profile Picture
    bakerhija 6 on at
    Issue with Multiple Conditions in "Filter Array" Action
    hi abm abm,
     
    thanks for your reply
     
    No, I'm looking to exclude some userPrincipalName from JSON
    filter all userPrincipalName found in conditions
    and return all userPrincipalName not found in conditions
     
    do you have another solution to filter array multiple condition?
    thank you
  • abm abm Profile Picture
    abm abm 32,188 on at
    Issue with Multiple Conditions in "Filter Array" Action
    Hi
     
    Thanks for your reply.
     
    @not(
      or(
        equals(item()?['userPrincipalName'], 'user1@example.com'),
        equals(item()?['userPrincipalName'], 'user2@example.com'),
        equals(item()?['userPrincipalName'], 'user3@example.com')
      )
    )
     
    This expression essentially says: If the userPrincipalName does not match any of the listed emails, return true. Are you looking to do something like this?
     
    Thanks

     
     
     
     
  • bakerhija Profile Picture
    bakerhija 6 on at
    Issue with Multiple Conditions in "Filter Array" Action

    hi @abm abm


    @not(
      or(
        equals(item()?['userPrincipalName'], '****@****.**'),
        equals(item()?['userPrincipalName'], '******@****.**'),
        equals(item()?['userPrincipalName'], '*****@****.**')
      )
    )

    I've tried it and the Issue persists, the filter apply the condition from the last query.
  • abm abm Profile Picture
    abm abm 32,188 on at
    Issue with Multiple Conditions in "Filter Array" Action
    Hi 

    Try the below
     
    @not(
      or(
        equals(item()?['userPrincipalName'], '****@****.**'),
        equals(item()?['userPrincipalName'], '******@****.**'),
        equals(item()?['userPrincipalName'], '*****@****.**')
      )
    )
     

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

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,008

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,531

Leaderboard

Featured topics