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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,465,224
Community Members
 
Community Events
176
Community Groups

Fields required based on other custom field values

Hello there,

We are using three fields in the create screen and they are

Upgrade (single select single choice), values are None, Yes, No, SC and ST ("customfield_1112")

Base version (text field single line) ("customfield_113")and

Final version (text field single line)  ("customfield_114")

When the Upgrade value is other than None, I need the Base version and Final version fields to be filled in. If the Upgrade value is None, there is no need for the required field. Please assist me with this; I'm new to scripts and your assistance is greatly appreciated. Please let me know if you need any information on this.

Note: We are using the Scrip runner  plugin in my server instance and help me how to solve this issue.

 

Thanks,

Siv.

1 answer

1 accepted

2 votes
Answer accepted
Fazila Ashraf Community Leader Dec 01, 2022

Hi @siva 

Check out the answer in https://community.atlassian.com/t5/Adaptavist-questions/ScriptRunner-behaviour-for-hiding-a-field-based-on-another/qaq-p/1755119 and use 

.setRequired(true)   

 as required for your use case.

 

Trying scripting as a newbie could be daunting.. But trust me, once you are able to understand the given script and modify it for your use case, it opens many doors :) 

Vikrant Yadav Community Leader Dec 04, 2022

Hi @siva  Kindly try to apply Behaviour on Upgrade field. 

As suggest by @Fazila Ashraf  , you only need to replace .setHidden with .setRequired

def dropDown = getFieldById("customfield_12345")//Change field ID as per your instance

//define base version field
def baseVersion = getFieldById("customfield_67891") //Change field ID as per your instance

//define Final Version field
def finalVersion = getFieldById("customfield_66666") //Change field ID as per your instance

//apply condition on select list field

if(dropDown.getValue()== "None"){
baseVersion.setRequired(true)
finalVersion.setRequired(true)
} else {
baseVersion.setRequired(false)
finalVersion.setRequired(false)
}

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events