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,555,951
Community Members
 
Community Events
184
Community Groups

How to set 'none - none' for cascading field using Behaviour?

Hi,

I have been trying to set some default value for cascading field based on another cascading field, I think I can able to set the value but could not able set the none - none value when others value has been set.

This article helps me to get cascading field value and This library helps me to set value for cascading field.

Ex: 

User selects

Cascading 1 -> A1 - AA1

Behavior sets

Cascading 2 -> X1 - XX1

When users change the value of Cascading 1 other than A1 - AA1, the cascading 2 still shows X1 - XX1, I wanted to set it to none - none for Cascading 2.

My script looks like

def selectListField = getFieldById(fieldChanged)
def selectListValue = selectListField.value

if (selectListValue.size() > 1 && (selectListValue[1] == "Framework & Tools" || selectListValue[1] == "Operational Efficiency" || selectListValue[1] == "Strategic Tech")) {
field.setFormValue([parentOption.optionId, childOption.optionId])
}

if (selectListValue.size() > 1 && selectListValue[1] == "Internal Integration") {
field.setFormValue([parentOption1.optionId, childOption1.optionId])
}

if (selectListValue.size() > 1 && selectListValue[1] == "Reduce Cost of Implementations") {
field.setFormValue([parentOption1.optionId, childOption2.optionId])
}
else{
field.setFormValue([null, null])
}

Regards
T

1 answer

1 accepted

1 vote
Answer accepted
Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 05, 2021

Hi @Teja,

 I tested below codes and both works fine for me to reset values for cascade field

cf.setFormValue([null, null])

cf.setFormValue([-1, -1])

 

Regards,

Leo 

Hi @Leo 

It works when I select both values from Cascading 1.

I need it to be set 'none - none' for Cascading 2, when Cascading 1 selects only the parent value?

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 06, 2021

@Teja, I've tested below code. it clears the value of cascade 2 when cascade 1 parent value changes

def ct = getFieldByName("Cascade One")
def ctval = ct.value as List
if(ctval.size() < 2 && ctval[0] != "alpha"){
getFieldByName("Cascade Two").setFormValue([null, null])
Like Teja likes this

Thanks @Leo 

Sure, I will verify this.

Regards
T

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events