Hi @Vando Goncalves (e-Core)
You can do this, but it requires:
Here is a high level explanation so you can get an idea of what is needed.
After the issue is created, we are going to create a second transition with the same name and screen, and have it go to the exact same status. In effect, we're going to create a transition where the Workaround field is required, and a duplicate transition where it is not. And, we are going to use the Conditions to hide one of the 2 transition buttons based on the value of what is entered in the Criticality custom field.
How To:
Because you did't list the status or transition names, I'm just going to use [ Create -> Open -> In Progress ] for this example. For the transition name, I'm going to simply call it "Start".
- From Create -> Open, the Criticality field is set based on your comment.
- From Open -> In Progress, you hit a transition button called "Start". This will display a screen where the "Workaround" field will be set to required, or not, based on the Criticality value.
- We are going to set one transition to display and not require Workaround, only if Criticality = Blocker
- We are going to set the 2nd transition to display and require Workaround, only if Criticality = Non-Blocker
Steps:
- Open your workflow designer.
- Create an additional transition from Open -> In Progress, and label it "Start" to match the original. If JIRA complains about the duplicate name, then make it "Start " with a space at the end.
- Set the transition screen to be the same screen the original "Start" transition is using.
- NOTE: From here on out, I will refer to the transitions as "Start 1" and "Start 2" so we can keep them separate.
- Open the Conditions view on Start 1
- Click Add Condition, select Script Condition (a feature of Script Runner Plugin), click Add
- Click on Simple Scripted Condition
- A list of links will display below, Click on "Has custom field value equal to"
- This will populate a quick code snippet in the field above
- Change 'SomeCustomField' to 'Criticality' (include the ' ' single quotes)
- Change 'Some Value' to 'Blocker' (again, include the ' ' single quotes)
- Click Add button at the bottom
- Start 1 transition button will now only display if Criticality = Blocker
- Open the Conditions view on Start 2
- Click Add Condition, select Script Condition, click Add
- Click on Simple Scripted Condition
- Click on "Has custom field value equal to"
- Change 'SomeCustomField' to 'Criticality' (include the ' ' single quotes)
- Change 'Some Value' to 'Non-Blocker' (again, include the ' ' single quotes)
- Click Add button at the bottom
- Start 2 transition button will now only display if Criticality = Non-Blocker
- Open the Validators view on Start 2
- Click Add Validator, select Fields Required, click Add
- Select Workaround, click Add >> button
- Click Add button at the bottom
- Start 2 transition now requires Workaround
- Publish Workflow
We just did 2 things
- Set 2 transitions to display/hide based on value of Criticality
- Set the 2nd transtion that shows when Criticality = Non-Blocker, to require Workaround field
Please note that setting a field as required through the Validator transition does not display a required asterisk, but it is actually required.
In cloud Version Also Script Runner Is Available
Thanks,
Venkatesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.