cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ianber
Microsoft
Microsoft

Is there a way to use "When there is a new message in a group" for Yammer Connection on specific text in message.

Hi there! 

 

Just delving into Power Automate Flows and am trying to setup a Flow for when a message has specific words in them. I'm trying to use the Trigger Condition @contain() but I'm not sure my syntax is correct for the string itself. Any insight on what I should be using? Is this the wrong approach?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @ianber,

 

We should configure the trigger contains condition as below:

@contains(triggerOutputs()?['body/content_excerpt'],'Keywords')

Screenshot 2021-04-20 151548.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-litu-msft
Community Support
Community Support

Hi @ianber,

 

We should configure the trigger contains condition as below:

@contains(triggerOutputs()?['body/content_excerpt'],'Keywords')

Screenshot 2021-04-20 151548.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks so much for the response! This worked brilliantly!

 

Quick follow-up question: If I wanted to put more than one keyword, does the "contains" function allow for that? Or do I need to use @And(contains())? So, as an example, I only want it to fire if the post says "today" and "blue".

Combine 2 "Contains" with one "And".

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

That's what I was thinking, but I also just read in some documentation (https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#c... that this function is case sensitive. So, that makes I actually need to check and see if one of four different possibilities is true. 

 

Basically if string contains

Today AND Blue

OR

Today AND blue

OR

today AND Blue

OR

today and blue

 

So would that mean I needed the following operation?

 

@or(and(contains(triggerOutputs()?['body/content_excerpt'],'Today'), contains(triggerOutputs()?['body/content_excerpt'],'Blue')), (and(contains(triggerOutputs()?['body/content_excerpt'],'Today'), contains(triggerOutputs()?['body/content_excerpt'],'blue')), (and(contains(triggerOutputs()?['body/content_excerpt'],'today'), contains(triggerOutputs()?['body/content_excerpt'],'Blue')), (and(contains(triggerOutputs()?['body/content_excerpt'],'today'), contains(triggerOutputs()?['body/content_excerpt'],'blue')))

You can make it much easier using toLower function:

and(contains(toLower(triggerOutputs()?['body/content_excerpt']),'today'), contains(toLower(triggerOutputs()?['body/content_excerpt']),'blue'))

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Excellent! I wasn't sure if toLower would work, so this is MUCH easier. 

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.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,678)