Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

IF/ELSE Script Runner Script Validator for Custom Field

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

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.
Feb 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

Hi @Pramodh M ,

Thanks for the quick response!

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

 

Regards,

Vinod Rathod

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.
Feb 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