I want to trigger a flow when a work item is updated to a certain state. However, once that work item is in that state, I don't want it to trigger anymore.
I was hoping to do this by having a way to compare "old value" versus "new value", but didn't see a way to do that.
For example, trigger when a work item is transitioned to the "Proposed" state, but once in that state, if the work item is updated with comments, etc, I don't want the flow to trigger.
Thoughts?
I figured it out. I entered the following for the trigger condition. With what I had posted above, I replaced utcNow() with triggerOutputs()?['body/fields/System_ChangedDate'].
@And(equals(formatDateTime(triggerOutputs()?['body/fields/Microsoft_VSTS_Common_StateChangeDate'], 'yyyy-MM-dd-hh-mm'),formatDateTime(triggerOutputs()?['body/fields/System_ChangedDate'], 'yyyy-MM-dd-hh-mm')),equals(triggerOutputs()?['body/fields/System_State'], 'Ready for UAT'))
This answer doesn't really help. I understand what you're trying to say. But I believe the reason @Zaemmel is asking this question is probably similar to my reason -- I'd want the flow to run when a work item is changed to "Ready for UAT" and send a message to a channel on MS Teams. But as long as the ticket state is "Ready for UAT", when the ticket is commented on, another message is sent via MS Teams and I don't want that. So I also thought a trigger would help, but I'm having difficulty with that. I tried the following but realized that this is not going to work either.
@and(equals(formatDateTime(triggerOutputs()?['body/fields/Microsoft_VSTS_Common_StateChangeDate'], 'yyyy-MM-dd-hh-mm'),formatDateTime(utcNow(), 'yyyy-MM-dd-hh-mm')),equals(triggerOutputs()?['body/fields/System_State'], 'Ready for UAT'))
Does anyone have any other suggestions/ideas/help?
Thank you.
Don't worry about the trigger, worry about the operation. Add a condition to the flow, that checks if there is a "proposed" state value. If there is, do nothing. If there is not, put it in a proposed state. Further:
If you could provide an expanded screenshot of your Flow and steps, your Flow run history, and of any detailed error messages you're receiving we could likely better assist you. Also, for the best results, you may want to review How to write a good forum post.
If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE.
rpersad
16
David_MA
10
Super User 2025 Season 1
Michael E. Gernaey
8
Super User 2025 Season 1