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
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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,207)