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

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 Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,101)