Conditionally require field during transition based on other field in Jira
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
When a user transitions an issue from one status to another, if a particular field contains a value, we need to enforce a different field to be set as well.
For example, imagine our project captures a user's chosen device using two fields with limited options:
Device
Mobile
Computer
Computer type
Desktop
Laptop
If the user is on a mobile device, the issue can transition without a value in the Computer type field.
If the user is on a computer, we want to capture whether they're on a desktop or laptop computer, so the Computer type field must now be filled.
Solution
Create two workflow transitions between the specific statuses
One transition will cover cases where Device is set to Mobile. The second transition covers the Device field set to Computer.
Navigate to Settings > Issues
Select Workflows
Scroll or filter for your desired workflow
Select ... (More options) > Edit
Switch to the Diagram editor
Choose Add transition
Select your desired From and To statuses, and choose a descriptive name for your transition
If necessary, repeat steps 6 and 7 until you have the proper number of statuses to cover your requirements
Configure the Device = Mobile transition
From the workflow Diagram editor, select the transition you'll use when the Device field is set to Mobile
Select Conditions, then Add condition
Choose the Value field condition and select Add
Select the Device field from the dropdown, choose = for the condition, and set value to Mobile
Select Add
Now, this transition will only be available when users set the Device field to "Mobile." Otherwise, they'll be presented with our next transition option.
Configure the Device = Computer transition
Because we require a specific field to be set during this transition, we also need to create and associate a transition screen. This screen must include the field we're requiring - in this example, the Computer type field.
For instructions on creating and configuring screens, please refer to: Configure work item screens.
Set the transition screen
Return to the workflow Diagram editor
Select the transition for when Device = Computer
Select Edit
In the Screen dropdown selector, choose the screen that includes Computer type created previously, and Save
Add condition for Device = Computer
Select Conditions, then Add condition
Choose the Value field condition and select Add
Select the Device field from the dropdown, choose = for the condition, and set value to Computer
Select Add
Add validator to require Computer type field
Select Validators, then Add validator
Choose the Field required validator and select Add
Choose the Computer type field from the field selector
Optionally, add an error message that users will see if they leave this field empty during transition
Select Add
Now, when a user sets the Device field to Mobile, they can proceed with transitioning the issue without any further input.
If Device is set to Computer, the Computer type field must be filled before proceeding.
You can use the same method to configure multiple branching transitions depending on your project's fields and options as well.
Was this helpful?