cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Balajied1999
Regular Visitor

PowerAutomate Condition in outlook where "To" should be from a person from a domain but not anyone else in the same domain

I am creating an alert flow in PowerAutomate where I wanted to add a condition where if "To" contains XYZ@domain.com but there is nothing else from @domain.com, then the flow would trigger an alert. If there are other email IDs in the "To" section which is not from @domain.com, The flow should still be triggered. I have pasted a screenshot of what I have so far but it does not seem to work.

 

Balajied1999_0-1638254885907.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
efialttes
Super User
Super User

@Balajied1999 
What a challenging issue!
I am assuming your Flow is triggered by means of 'When a new email arrives'
If so, I would rather transform and merge To and CC into a single array by means of union() and split() functions, use 'Filter array' to remove XYZ@domain.com; then convert back Filter array output into a string by means of join()

efialttes_0-1638260571878.png

I am using the following expression in 'Initialize variable'...

 

union(split(triggerOutputs()?['body/toRecipients'],';'),split(triggerOutputs()?['body/ccRecipients'],';'))

 

...also the following expression as left term of 'Filter array'...

 

item()

 

...and finally the following expression as the left term on 'Condition':

 

join(body('Filter_array'),';')

 

Hope this helps




Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Hi again!
Well, it seems my proposal matches your requirements, right? Or am I missing something?
Please give it a try and let us know your progress
Thanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

4 REPLIES 4
efialttes
Super User
Super User

@Balajied1999 
What a challenging issue!
I am assuming your Flow is triggered by means of 'When a new email arrives'
If so, I would rather transform and merge To and CC into a single array by means of union() and split() functions, use 'Filter array' to remove XYZ@domain.com; then convert back Filter array output into a string by means of join()

efialttes_0-1638260571878.png

I am using the following expression in 'Initialize variable'...

 

union(split(triggerOutputs()?['body/toRecipients'],';'),split(triggerOutputs()?['body/ccRecipients'],';'))

 

...also the following expression as left term of 'Filter array'...

 

item()

 

...and finally the following expression as the left term on 'Condition':

 

join(body('Filter_array'),';')

 

Hope this helps




Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Yes Close. What I want is that when a new email arrives in a shared mailbox (XYZ@domain.com), most people outside the organization copy someone or the other from the organization along with the mailbox email ID. There are rare cases where clients send the email to only the Shared mailbox's email ID and these emails go unnoticed. So what I wanted was that if we get an email where a client only sends the email to the shared mailbox with no one else from @domain.com, Admin gets the notifications.

Hi again!
Well, it seems my proposal matches your requirements, right? Or am I missing something?
Please give it a try and let us know your progress
Thanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



That really helped me Thanks!

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (1,341)