Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

0 votes
xelomax
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events