cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Katie
Frequent Visitor

Contains Function Match to Specific Keywords/Phrases

Hello!

 

I am trying to have a flow using PA where when an email is received with specific conditions in the subject, that a post is made to a Teams channel. I am trying to have this flow setup for each channel, as each represents a state or region, where the subject contains specific keywords/phrases to match to. 

 

For example, an email comes in with a subject line similar to "ALERT 20NM NE "WB" (SCWS001)". The "WB" is a code for where this is, lets say Florida. I want PA to post that email to the "Florida" Teams channel I have setup. I have gotten it to post the email to the Teams channels, but it isn't posting to the correct one each time. 

 

Below is the flow as I have it setup right now:

1.jpg

 

2.jpg

 

I think this is an issue with the way I have to tell PA to match the keywords/phrases and I just don't know how to specify that I need it to match exactly to that one very specific portion of the subject. 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Katie ,

the editor changed the quote characters in the response from @v-bofeng-msft. It has different quote character than the expression expects, try it as:

split(triggerOutputs()?['body/subject'],'"')[1]

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

10 REPLIES 10
tom_riha
Super User
Super User

Hello @Katie ,

if there's a different channel for each of the subject codes then you can't have them all in a single condition. You'll need a separate condition for each of the codes:

  • if subject contains WA
    • post message to florida
  • if subject contains PA
    • post message to xxxx
  • ....


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
Katie
Frequent Visitor

Thank you for your response!

 

To clarify, I have many codes I need to match where any of those would go to one channel.... For example, I have code X, XY, XZ, AA, etc. and all of those need to post to the "Florida" channel. So I would have to set each of these as a separate condition?

 

Also, would you happen to know if there is a way for me to tell PA that I want it to match the code to only one very specific portion of the subject? (i.e. it says something like ALERT ### "CODE" (ABC123) and I need the condition to match ONLY the "CODE" piece.

v-bofeng-msft
Community Support
Community Support

Hi @Katie :

Please try:

vbofengmsft_0-1638253945631.png

Best Regards,

Bof

 

This is definitely helpful, but I think I must be missing something because it isn't working... Could you check and see if this is missing anything?

 

1.PNG2.PNG3.PNG

Hi @Katie :

vbofengmsft_0-1638775891029.png

Best Regards,
Bof

 

Hi there,

 

When I put this formula 

split(triggerOutputs()?['body/subject'],"")[1]  into the expression bar, I get the below error message
 
I get the same error message if I remove the [1]
error.PNG

 

Hi @Katie :

Please copy and paste this formula directly:

 

split(triggerOutputs()?['body/subject'],‘’)[1]

 

 

Best Regards,

Bof

Hello!

 

I have tried this and I still get the same error message ☹️

Hello!

 

I have tried this and I still get the same error message 

Katie_0-1640008630154.png

 

Hello @Katie ,

the editor changed the quote characters in the response from @v-bofeng-msft. It has different quote character than the expression expects, try it as:

split(triggerOutputs()?['body/subject'],'"')[1]

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

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.

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,472)