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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,612)