We have created a custom workflow, with custom statuses to represent 2 different 'work groups':
1) 'At Support' (issue is with the Support 'work group')
2) 'At Tech Support' (issue is with the Tech Support 'work group')
Both of the above statuses can transition to the status 'At Reporter'.
When the 'Reporter' comments, we want the issue to transition back to the most recent status just before that.
I tried adding this to the IF condition:
"status changed from "At Tech Support" TO "At Reporter".
That gets me 80% of the way. The problem is that the above query catches any issue that EVER underwent that transition. I want to catch just those issues where the MOST RECENT transition was "At Tech Support" TO "At Reporter".
Can anyone think of an elegant approach for this?
I implemented a solution to a problem very similar to yours. Not sure if one can classify it as elegant, but it works. Here's what I did...
In my case, when the issue is in the Waiting For Customer (WFC) state, and the Reporter comments, the workflow transitions back to Waiting For Support (WFS). However, what I want the workflow to do is transition to the state the issue was in before it transitioned to WFC. How do I know the state previous to WFC? I store the state in a custom field. Let's say the custom field is preState. The custom field is not visible on any screen.
So, in the transition Respond to support, which is the transition that takes the issue from WFC to WFS, I have a post function that transitions the issue to the previous state saved in the custom field preState. The post function I execute is Transition issue. It's available in the JIRA Misc Workflow Extensions add-on. When configuring the Transition issue post function, there are two fields to fill in. 1) A transition to execute, and 2) a condition. I'll finish my answer w/ specifics.
Let's assume that one possible state that my issue can be in before transitioning to WFC is Accepted. Then I what I did is added a Transition issue post-function to my Respond to support transition so that I automatically go back to the Accepted state if Accepted was the state previous to WFC. To configure the Transition issue post function, I specified Accept for the Transition field and the following code for the condition.
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
CustomField customField_name = customFieldManager.getCustomFieldObjectByName( "preState" );
String preWFCstate = issueObject.getCustomFieldValue(customField_name);
Please consult the attached image of my workflow. So sorry for the really lengthy answer. Hope it helps.
IMPORTANT NOTE: In my implementation, the Accept transition from WFS to Accepted cannot have a screen. Otherwise the Transition issue post function from WFS to Accepted will not work.
Many thanks for your detailed feedback (and my apologies for the delayed response).
I came to a similar conclusion myself, before I saw your answer.
I use a hidden field, but without a custom plug-in - just using the 'automated rules' builder in SD 2.4.1.
Each time a relevant transition takes place, I use a post function to store the previous status in the hidden field. (I think that part is common to your approach.)
Then, in the automated rules section, I check for the 'previous status' before deciding which transition to invoke.
PS: Not as elegant, as I wanted, but it works...
The Jira Service Desk marketing team is working on a guide to help new Atlassian customers switch from email to JSD and we'd love to hear from you! Please share: - What made you realize that i...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG