IF/ELSE Script Runner Script Validator for Custom Field

Vinod Rathod February 13, 2022

Hi Team,

Require the IF/ELSE Script Runner Script Validator for Custom Field.

Scenario is: 

1. I have three A, B, & C Cascading Custom Field on Resolve Screen,

2. Based on the requirement if ticket is raised for A, then only A field options is require, if I select B, then only B custom field options require in Validator.

3. Like wise for C Custom field. etc.

 

Let me know, if you don't understand the above points.

 

Regards,

Vinod Rathod

3 comments

Vinod Rathod February 13, 2022

Hi Team,

 

For More reference please refer the attached screenshot of the Validator require for any one of the Custom field select.

Custom Field.PNG

Regards,

Vinod Rathod

Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2022

Hi @Vinod Rathod 

Here's an example

def closure_col = getFieldById(getFieldChanged()).getValue().toString()

if (closure_col == "") {

getFieldById("customfield_10301").setHidden(false);

getFieldById("customfield_10301").setRequired(true);

}

else if (closure_col == "") {

getFieldById("customfield_10302").setHidden(true);

getFieldById("custom field_10302").setRequired(false);

}

else {

getFieldById("customfield_10303").setHidden(true);

 

getFieldById("custom field_10303").setRequired(false);

}

"customfield_10301" id is the id of the first cascading field

Replace only the ID

You can get that when you edit the custom field, it will be visible in the URL

Let me know if you have any queries

Here's a ref

https://community.atlassian.com/t5/Jira-questions/How-to-show-a-new-field-based-on-another-custom-field-value/qaq-p/1940007

Thanks,

Pramodh

Vinod Rathod February 13, 2022

Hi @Pramodh M ,

Thanks for the quick response!

I will try the suggested workaround and get back to you.

 

Regards,

Vinod Rathod

Vinod Rathod February 13, 2022

Hi @Pramodh M ,

Sorry to inform you, this Jira Cloud!

We have 3 Cascading Field on the Resolve Screen are as follow,

  • Close Category - Application,
  • Close Category - End User and
  • Close Category - Infrastructure.

So, If ticket is raised for any of the above, and select the Any One of the Custom Filed then, I want the Second Value should be Require of Cascading Field.

I have used the following Parameter in the Validator for Close Category - Application,

  • cfValues["Sub-Category - Application"]?.getKeysAndValues()?.size() == 2

But on the Resolve Screen If I want to Select only Any One of the Close Category Field, so how can I achieve this requirement.


Please let me know, if you can any concerns.

 

Regards,

Vinod Rathod

Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2022

Hi @Vinod Rathod 

For Cloud, we have Forms feature

Here's a link to Conditional Feature 

https://support.atlassian.com/jira-service-management-cloud/docs/add-a-conditional-field-to-a-service-project/

Let me know if you have any queries

Thanks,
Pramodh

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events