I want our Product Bug Issue Type to have a required checkbox asking if the proposed change will have x impact.
If yes, I want the field to display a multi line text box field requesting more information.
Can anyone point me to documentation that can help me out?
Thanks
Ryan
@Nic Brough -Adaptavist- , Could you please help me how to setup a dynamic fields display based on the Cascading Field list.
I have one Cascading field, Two Text fields on our instance. We want to display or hide text field based on the cascading value.
If possible please provide the script here, Thanks.
There's a load in the library. https://library.adaptavist.com/entity/set-available-options-to-a-multi-select-list might be a good start
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist- , I couldn't find the code to display or hide fields based on custom field cascading values.
I don't now how to use the logic on the cascading field. Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'd have a look at the rest of the library. I am not going to write your code for you (I've not done it before so I have nothing to hand over)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you please help me how to setup a dynamic fields display based on the Cascading Field list.
I have one Cascading field, Two Text fields on our instance. We want to display or hide text field based on the cascading value.
If possible please provide the script here, Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you elaborate your use case a bit in detail? Have you written some code already?
If you are dealing with cascading select list then something like this can be helpful. The code will hide a field based on values selected in cascading select list (parent or child).
/**
Hide a field based on the values selected in either parent or child of a cascading select list.
Cascading field: Country and city
Parent options: [India, UK]
Child options: [Delhi, Mumbai], [London, Reading, Slough]
**/
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.config.FieldConfig
import com.atlassian.jira.issue.customfields.option.Options
log.debug("******Logging starts********")
def parentField = getFieldById("customfield_10401")
def parentFieldValue = parentField.getValue()
def childField = getFieldById("customfield_10401:1")
def childFieldValue = childField.getValue()
def fieldToHide = getFieldByName("Review Date")
log.debug("Parent Field: " + parentFieldValue)
log.debug("Child Field: " + childFieldValue)
/**Hide based on parent field **/
if( parentFieldValue.containsAll("UK")) {
fieldToHide.setHidden(true)
} else {
fieldToHide.setHidden(false)
}
/**Hide based on child field **/
/*
if( childFieldValue == "Delhi") {
fieldToHide.setHidden(true)
} else {
fieldToHide.setHidden(false)
}
*/
There is no error handling in this code but it will give you some idea.
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Method name is containsAll() check your code.
"..if (ProblemCodeValue.fcontainsAll("xxxxx")) { "
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to log.debug("ProblemCode Value: " + ProblemCodeValue) to check what it is returning. If it is just a string then in your condition remove containsAll() with ==
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Paste your complete code and also share what type of fields are those in your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ravi Sagar _Sparxsys_ , When specific value selected on Cascading field(Problem code), Test fields should hid or show on the create screen. I am using below code(No errors on the code), not working for me. Could you please help me with this.
Field Types:
"ProblemCode" - Cascading field
"Callsamples" - Text field
"StepstoReproduce" - Text field.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.config.FieldConfig
import com.atlassian.jira.issue.customfields.option.Options
def StepstoReproduce = getFieldByName("Steps to Reproduce")
def Callsamples = getFieldByName("Call samples")
def ProblemCode = getFieldByName("Problem Code")
//create map
Map cfVal = ProblemCode.getValue() as Map
if(cfVal.get(0) == "XXXXX")
{
Callsamples.setHidden(false)
StepstoReproduce.setHidden(false)
}
if(cfVal.get(0) == "YYYYY")
{
Callsamples.setHidden(true)
StepstoReproduce.setHidden(false)
}
if(cfVal.get(0) == "ZZZZ")
{
Callsamples.setHidden(false)
StepstoReproduce.setHidden(true)
}
if(cfVal.get(0) == null)
{
Callsamples.setHidden(true)
StepstoReproduce.setHidden(true)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, I was hoping there would be an option in the product itself.
Have you used this for a similar situation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's one of the reasons the behaviour module in Scriptrunner was written - because Jira does not have functions to show/hide fields.
A lot of people use Behaviours for this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You will need to install something like Scriptrunner, to enable you to inject code on the front-end that can show and hide fields depending on the content of others.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.