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!
Solved! Go to Solution.
Hi @ianber,
We should configure the trigger contains condition as below:
@contains(triggerOutputs()?['body/content_excerpt'],'Keywords')
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.
Hi @ianber,
We should configure the trigger contains condition as below:
@contains(triggerOutputs()?['body/content_excerpt'],'Keywords')
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".
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'))
Excellent! I wasn't sure if toLower would work, so this is MUCH easier.
User | Count |
---|---|
88 | |
37 | |
25 | |
13 | |
13 |
User | Count |
---|---|
121 | |
55 | |
36 | |
24 | |
21 |