Hi there. I don't expect this to be super complicated but I'm not totally clued up on Flow expressions just yet and have a question. I have a Sharepoint Created / Modified trigger and I currently have a handful of Condition > Terminate functions to kill off the flow under certain conditions, and would like to make use of trigger conditions instead in order to save flow runs. I'm just trying to wrap my head around the terminology though. Could someone clarify what the actual expression would be if I wanted the flow to ONLY run when:
STATUS column = Pending Approval
AND
APPROVER column contains information
It's pretty simply doing this with the terminate condition, and I know / think the beginnings of the expression will be something along the lines of the below, but expanding this to accommodate the two pieces of criteria with AND operator I'm unsure about. Can anyone advise?
@equals(triggerBody()?['STATUS']?['value'],'Pending Approval')
Hi, thank you for the tips. I'm the only one at the bank who creates flows and I'm not technical. I never annotate anything. I go back and open a previous flow and look at what I did before and then use that to refresh my memory on how to solve a new challenge in my latest flow. I'll have to look into leaving myself some notes in the future. 🙂
👍👍👍👍👍👍👍
Oh, seriously, don't worry about it ... I operate on the assumption that I'm the least important person in a room, so it's relatively hard to irk me.
I still think you're absolutely right, though, that it needs a better interface.
I didn't know about all the articles online telling folks how to make the trigger conditions using the Filter action. But believe you me, I'll be repeating it again on this place. 😅
----
With regards to what you're saying, though, I feel your pain.
Just remember, though, each Trigger Condition is adding an extra condition to an invisible and() expression. 😉
----
Also, I am new to coding myself. On the surface of it, I believe that (in general) Power Automate flows should be made so that anyone could possibly look at the flow and understand what is happening.
That is why if it's a flow made by a member of staff that isn't perhaps in a technical role, for the benefit of other members of staff, then it should be a simple as possible. I mean we're trying to get AWAY from those darned spreadsheet formulas, here!
If I can offer one little nugget, there, though ... if you ever find that you've spent a long time on either some complicated logic, or that you've used an expression anywhere in a flow ... try to annotate that. Either purely by pasting the complicated expression in the 'Add a note' section of an action, or by talking through what's happening in the same field.
In coding I'm sure the equivalent is to add comments to your code to annotate it.
I am someone new to expressions. I don't code at all. And I've been experiencing the very problem I'm talking about where it actually did not work effectively. I'm speaking to my own reality. LOL I was trying to say that there are so many articles where people tell you how to hit the Advanced link on the Array action to create the expression and then delete the array, but not much to help to combine all the nested and/or. I actually created an official suggestion for this a few minutes ago with Microsoft because I doubt I'm the only no code person relying on the generosity of people like pstork and yourself for the code to put in.
Thank you so much for the second spoiler. This helps me learn how to code; kind of like training wheels. I had already taken pstorks code he gave me and looked at it against my Condition action UI to see how it matches up and how to structure that on my own. I will also use your spoiler to add my my arsenal of when I have to code in order to use Power Automate effectively. (Except that my scenario request AND and OR, not one or the other but both.) Also, I think I might have thought you were responding to my question to pstork along with the original person, which was not just to convert to an expression, but you were really only talking to him. My confusion, the replies here are sometimes hard for me to follow. 🙂
It isn't supposed to help with combining, @AntoinetteB, the list of Trigger Conditions is inherently an and() wrapper.
You're right, though, about using that Condition action front end, it does need that.
When someone is just starting out learning this stuff then it's far more applicable to:
See below spoiler for how that might look:
Saying something like this could make a person new to the system doubt that it will work effectively, which isn't fair on them, Antoinette. Because something like this does work, especially for helping people new to expressions to add a simple Trigger Conditions.
What it *doesn't* do is help with an or() Trigger Condition. If someone new to expressions, who is still uncomfortable with the expression builder, then they may still wish to use the filter method.
An or() trigger can still be made, though, but it is *technically* writing an expression. The easiest way to do this using the Filter method would be what I've plotted out in this spoiler, which one could also use for and():
Sadly that does not help with combining multiple trigger conditions. It just gets you the trigger conditions to start with and you have to figure out how to combine them yourself. It makes me think though, if you can use a Condition action and neatly put in all your "and" and "or" conditions without code, I wish Microsoft would use that same Condition screen in the trigger condition.
@Anonymous , I'm sure you've got a good answer below, but if you want a really easy way to go about making a trigger condition, just use a filter to make it, tap the 'advanced' link, and copy the formula out of that!
I've copied a step by step for this in the below spoiler (supplied to a user who was similarly wary about expressions) which should guide you through just how easy it is:
You need this here to ensure that this flow doesn't run for every single change on the list.
Follow these steps to easily create a trigger condition:
Congratulations, you have made your first trigger condition!
🏆
Its not really a specific language since this is a low code/no code system. the closest would be Excel or Azure Logic app functions.
Thank you so much! It never occurred to me to try to separate it out on different lines to make sense of it. Although that's what I do when I have to fool with VBA in Excel. BTW not a big deal but do you know what kind of code this is that we use in Power Automate? Just this one time I happened to ask one of our developers for help with this, and he could not help, but he said I could get back to him if I knew what language it was. I just Initialize Variable and hit Advanced and copy/paste the expression it gives me. But I don't know what language it is.
You just nest the conditions as needed.
@And(
contains(triggerBody()?['{FilenameWithExtension}'],'.xlsm'),
or(
and(
equals(triggerOutputs()?['body/{ModerationStatus}'], 'Approved'),
equals(triggerOutputs()?['body/{IsCheckedOut}'], false)
),
and(
equals(triggerOutputs()?['body/{ModerationStatus}'], 'Denied'),
equals(triggerOutputs()?['body/{IsCheckedOut}'], false)
)
)
)
Hello, I see there is now a +Add function built into the Trigger Conditions so you don't have to build it into the string. Unfortunately I need to put both AND and OR into one string.
I'm already using Array: @triggerOutputs()?[‘body/value’] and Trigger Condition @contains(triggerBody()?.
I want to expand the trigger condition to this:
@contains(triggerBody()?[‘{FilenameWithExtension}’],’.xlsm’)
AND
@equals(triggerOutputs()?[‘body/{ModerationStatus}’], ‘Approved’) AND @equals(triggerOutputs()?[‘body/{IsCheckedOut}’], false)
OR
@equals(triggerOutputs()?[‘body/{ModerationStatus}’], ‘Denied’) AND @equals(triggerOutputs()?[‘body/{IsCheckedOut}’], false
I'd be most appreciate if you're able to help:
1) I’m not clear on how to nest the 2 AND conditions in to the OR condition.
2) I'm not clear on whether I need to make any changes to the @triggerOutputs()?[‘body/value’] that is in the Array field because I added the original trigger condition so long ago I don't recall why I added that Array.
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional