Power automate trigger condition on new record created on a sharepoint and field name 'username' matches a list of of names

Kale Pinaz 0 Reputation points
2023-04-18T20:37:53.0233333+00:00

I am trying to create a power automate workflow on new item being added to SharePoint list. Now I need an email sent when a new item is added to the list AND column name 'UserName'( matches any of the set of values ( which could be like 50 users) I know I could use the trigger condition but how can I make the trigger condition regex use a set of value. UserName in ( 'John','Mary','Eric'.......etc) - this can be a very very long list

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,300 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Haoyan Xue_MSFT 22,466 Reputation points Microsoft Vendor
    2023-04-19T06:22:30.1166667+00:00

    Hi @Kale Pinaz ,

    What type of column is your 'UserName' column?

    During my testing, 'UserName' is a single-line text column.

    User's image

    Regular expressions are currently not allowed in Power Automate.

    You can use the formula I provided and continue to add user name conditions according to your needs:

    @or(contains(triggerOutputs()?['body/UserName'],'John'),contains(triggerOutputs()?['body/UserName'],'Mary'),contains(triggerOutputs()?['body/UserName'],'Eric'))
    
    

    When I create a new item with 'UserName' as 'John', the condition is automatically triggered.

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.