The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How can I make multiple fields mandatory depending on selections in single-select list?

Destri Weir
October 1, 2024

 

My current script isn't working at all. It doesn't even look like the behavior is being triggered. 

I'm attempting to make 3 fields--Supplier (10132), Live Date (10343), and MPAN/MPR (10256)-- mandatory when one of the following selections is selected from the Ticket Category (10123) drop-down list:

  • Commissions - Missing Payment/Incorrect Payment
  • Commissions - Supplier Payment Terms Query
  • Commissions - Commission Statement Query
  • Commissions - Update Brokerage Info
  • Commissions - Received commission clawback
Here is the current script that I have in the Edit Field Scripts screen:

const changedField = getChangeField(); // List of ticket categories that will trigger the requirement const requiredCategories = [ "Commissions - Missing Payment/Incorrect Payment", "Commissions - Supplier Payment Terms Query", "Commissions - Commission Statement Query", "Commissions - Update Brokerage Info", "Commissions - Received commission clawback" ]; // Check if the changed field is the Ticket Category field and if the selected value is in the requiredCategories list const isRequired = changedField.getType() == "com.atlassian.jira.plugin.system.customfieldtypes:select" && changedField.getName() == "Ticket Category" && requiredCategories.includes(changedField.getValue().value); // Set the required status for the specified custom fields getFieldById("customfield_10256").setRequired(isRequired); getFieldById("customfield_10343").setRequired(isRequired); getFieldById("customfield_10132").setRequired(isRequired);

 

See Behavior set up screenshots below:

Screenshot 2024-10-01 135904.png

Screenshot 2024-10-01 140035.png

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Marcelo Ulloa
October 1, 2024

Hello

If you are trying to use it in "Jira Service Management", it does not work since it is not supported yet for that type of project.

 

image.png

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events