I am trying to trigger some actions (email or Slack msg) when someone updates the rank of a certain set of work items.
The condition I am currently using is:
Trigger: When work item updated
Condition: {{changelog.Rank}} does not equal Empty
I have other conditions as well to narrow the list, but the one I am having trouble with is detecting if the most recent edit contained a rank change.
My above does not work, because it triggers if there has EVER been a change to rank (that smart value returns a list of changes to Rank for the history of the issue).
What I need to do is find out if the most RECENT edit to the issue was a rank change.
Note related discussions here. This person was on a similar track, but ultimately was hung up on another issue.
Is there a way to query the Changelog for the most recent edit changes only?
After sleeping on it and re-thinking it, I simply changed my query approach and got it to work.
In the long thread with Bill, I keep trying to check this condition:
If {{changelog.rank}} does not equal empty
That should work, but perhaps something was misformed. Not sure. It would trigger on ANY edit, not just re-ranking edits.
Then I shifted my strategy to check this condition:
If {{changelog.rank.toString}} contains Rank
This condition works properly! If there is a rank change, it fires and I get the notice. If any other edit, it does not fire. Solved!
Hi @Michael Ball-Marian -- Welcome to the Atlassian Community!
First, what problem are you trying to solve? That is, "why do this?" Knowing that may help the community to offer additional suggestions.
Next, what version of Jira are you using: Cloud, Server, or Data Center?
I ask that question because with Jira Cloud, the {{changelog}} smart value provided to rules for a field update or generic work item updated trigger only contains information about the changes which triggered the rule, and not a complete list of all changes over time.
With those trigger types, when you need to know the last change to the Rank value, you could try using that smart value, stored in a Created Variable, and then looking for the field's name in the text. To guarantee one only has the latest change for that specific field, they would need to read the changelog entries using the REST API endpoint with the Send Web Request action.
However...
Many things can change the Rank for a work item, including just drag-and-drop to change Status on a board. Thus the result could be quite "noisy" messaging.
And the Rank field contains a Lexorank value, and may have little meaning to people reading it in its encoded format. That is, you could not tell from just looking at a value if something is the N-th value in a backlog.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bill!
We are using Jira Cloud.
I appreciate the "why are you doing this" question. I should have provided that context up front.
I want to use this query against a short, filtered list of JPD ideas. One example is a ranked list of ideas for the current quarter. We have some stakeholders who are not going to participate in detailed meetings - they just want to know if priorities are shifted.
The messaging will not be noisy, "I know what I'm doing" in this case.
Regarding this:
trigger only contains information about the changes which triggered the rule, and not a complete list of all changes over time.
I am not sure this is true, because when I use the condition I mentioned:
Condition: {{changelog.Rank}} does not equal Empty
The rule is triggered for every edit of the issue (e.g., a text edit to description).
My initial thought was exactly what you said: that the changelog would only contain changes from the triggering edit. I will try outputting that as a string to see what is going on.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tested this, and the result is indeed empty for edits that do not include re-ranking.
This leaves me puzzled...is "Empty" not the correct condition to check for? Null doesn't work either.
Currently, my rule executes for every change, regardless of whether the condition is true or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is curious...time to test and verify!
When I just edited the Description in a JPD Idea, with a rule using Work Item Updated, the changelog did not contain the Rank field in all four ways I checked it:
Then, I updated the Idea by only dragging it higher in the list to re-rank, and all four methods showed the Rank change. And it only showed that specific Rank change, not the entire history.
Same when I did a status transition on a "board" view by dragging it to another status column.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using a condition on the trigger (i.e., the new feature just added) or using a separate Smart Values Condition after the trigger?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bill,
I was using the condition as an IF condition, after the trigger (see my flow below).
I don't think "Field Value Changed" will work for RANK? The only way I can see to do it is to trigger on work item update, and then test for the condition using smart value?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are correct on the trigger to use Work Item Updated when checking for a Rank change.
I notice you are using a different smart value than what I tested. After a quick re-test I find:
This appears to be another case where rules have similarly named, although different purposed, smart values. (Another example is {{sprint}} versus {{issue.sprint}} for the sprint-related triggers: the first one is for the trigger event and the second has all the issue's sprint values / history.)
Please use {{changelog}} for your condition to learn what happens. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy - I'm sorry - I was testing and changed that just to see if it made a difference.
I get the same result as with {{changelog.Rank}}. The action ALWAYS triggers, even if rank was not updated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just tested this again with Jira Cloud and it worked as expected: with the generic Work Item Updated trigger and the Smart Values Condition, the rule only proceeded when the Rank changed.
What action were you taking when the rule triggered? That is, what happened to the work item?
There is a possibility the rule is "glitched". That is, the rule's behind-the-scenes JSON is broken due to several update / publish cycles. The way to check for that is:
There is also a very unlikely possibility: has someone created a custom field named Rank which is colliding with the built-in one?
You may check that using this how-to article to observe if there are multiple fields named Rank provided to the rule for work items:
https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To test this, I tried to different actions on the issue in Jira: I edited description and I changed the rank on a rank-ordered list.
I expect that editing description should not trigger the rule, while re-ranked would.
I continue to see the rule trigger in either case.
I just tried:
I have no idea at this point.
When I look at the changelog via API, I can find the changes where I am editing text vs rank. The text edit changes do not include Rank changes. I am totally stumpped!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I figured it out, using a slightly different approach. Will post answer in a new comment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy Thanks for your dedicated help! I appreciate it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Welcome to the community.
As mentioned in the related discussion, I agree with @Bill Sheboy .
Talk to your team, as this can be a disruptive action a a product owner or scrum master or service manager doing their work on arranging issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.