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,301,415
Community Members
 
Community Events
165
Community Groups

I want to show/Hide a field(multi line text box) based on option selected in multi select field. I a

Hello,

 

I want to show/Hide a field(multi line text box) based on option selected in multi select field. I am using the below code but this only hides the "multi line text box" but never shows-

////////////

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor


@BaseScript FieldBehaviours behaviours
def reasonForBlock = getFieldById("customfield_11842") //
def flaggedField = getFieldById("customfield_11829") //
def selectedOption = flaggedField.getValue() as String
log.debug "Selected option: $selectedOption"
if (selectedOption.toString().contains("Other")){

reasonForBlock.setHidden(false)
}
else {
if(reasonForBlock.value)
{
reasonForBlock.setFormValue(null)
}
reasonForBlock.setHidden(true)
}

 

Can someone help?

 

Regards,

Priyanka

1 answer

1 accepted

0 votes
Answer accepted

Hello @Priyanka khare

I had tried to run your script, and it's working fine on my end.
Please correct me if I got you wrong, I understand that you wish only to show the field while the "Other" option was selected on the multi-select field.
May I check if the multi-line text box will never show when you select the "other" option on the multi-select field?
Please make sure that you apply your Behaviour script as a server-side script to detect the changes everytime.

hello,Lih Yao

I also want to try the script.Could I know how you run the script or where you run the script.

Hello @Sophia Chen ,

To run this script, you should need to install ScriprtRunner in your Jira.
Like I mentioned, please make sure that you apply this script as a Behaviour server-side script.

I would like to suggest you look at this document to understand how the script will work with Behaviour.

I hope this helps. :) 

Thank you for your answer,Greatly appreciated! However,it‘s too expensive. We might not use this app.

Thanks again for your reply.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

📅 Partner Webinar & Events Opportunities: July 2022

Hi community 👋, Here is another monthly roundup of the partner-organized events in July 2022. If there is any event missing please let me know in the comments below 🙏 If you're looking for Atla...

24 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you