Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Post Functions without Plugin

Patrick Finn June 5, 2020

Hello!

I've been searching endlessly on how to incorporate validated post functions into a transition, but haven't found anything in the forums that has applied to our situation.

What we would like to do is have a transition that:

  • if coming from status xxx, automatically updates a field (resolution) and only requires the user to comment on the transition screen
  • else, the resolution and comment fields presented on the transition screen are required

I know how to set a conditional based on the status a ticket is coming from using Groovy:

issue.status.statusCategory == "xxx"

 However, I'm having trouble with the other aspects mentioned above (field update, required input).

2 answers

1 vote
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2020

You will need a plugin to enable you to do that.

To do it exactly as described, you'll need a validator and a post function.  You'll also need to decide whch route to take through the contradictions of "set a resolution" and "make it mandatory for the user" - you can do one or the other not both.

Patrick Finn June 8, 2020

There's no way to do this using a custom Groovy script? We have access to the Jira Misc Workflow Extensions (JMWE) app.

0 votes
David Fischer
Community Champion
June 8, 2020

As Nic said, you can't just hide fields from transition screens, that's not how Jira works.

The solution is to use two Global transitions, one with a screen that shows the Resolution field, and one with a screen that doesn't show it but instead includes a Set Field Value post-function to set the Resolution. And you'll use a Scripted (Groovy) Condition on each to hide the transition that doesn't apply, based on the status category.

However, it is generally not good practice to use global transitions. Instead, you should design your workflow using regular transitions between statuses, so that you have full control over which transition is available in which status, and so you can also display the workflow to users.

Suggest an answer

Log in or Sign up to answer