Hi, Folks!
You know, I'm trying to make some checkboxes hidden when I select specific checkboxes of the field.
For example, I have:
"Custom Field" - checkbox type
"A","B","C","D" - the values of this field.
IF I select values "A"&"B" so that values "C" & "D" should be hidden.
How can I solve it is?
Please help me.
Many thanks for advice.
This isn't really possible through behaviours, its only possible to hide the complete field not specific checkboxes within it.
Although as a workaround you could use two separate checkboxes and have this script on the checkbox field which contains "A" and "B" and "C" and "D" are on a completely different field. It sounds like they are kind of independent anyway.
import com.onresolve.jira.groovy.user.FieldBehaviours import groovy.transform.BaseScript @BaseScript FieldBehaviours fieldBehaviours // this field contains boxes A and B def checkboxField = getFieldById(getFieldChanged()) // This contains boxes C and D def otherCheckboxField = getFieldByName("Other Checkbox") def values = checkboxField.getValue() as List<String> if (values.containsAll(["A", "B"])) { // hide field containing C and D when A and B selected otherCheckboxField.setHidden(true) }
Hi @Adam Markham [Adaptavist], just wanted to clarify:
Is it not possible to hide checkbox field options at all, or only in the use case presented in the question?
I can use the script below to hide options on a Select field using the Behaviours initializer, but it doesn't work when applied to a checkbox field. I thought they were controlled by same Options classes? Please excuse me if I'm using incorrect nomenclature.
def formField = getFieldByName("Some field"); def customField = customFieldManager.getCustomFieldObject(formField.getFieldId()); def config = customField.getRelevantConfig(getIssueContext()); def options = optionsManager.getOptions(config); def optionsMap = options.findAll { it.value in ["Some option"] }.collectEntries { [ (it.optionId.toString()) : it.value ] } formField.setFieldOptions(optionsMap);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do we know if Adaptavist has thise feature in future roadmap to hide options on checkboxes using behaviors ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.atlassian.jira.ComponentManager
import groovy.transform.BaseScript
import static com.atlassian.jira.issue.IssueFieldConstants.*
import com.atlassian.jira.component.ComponentAccessor
import com.opensymphony.workflow.InvalidInputException
@BaseScript FieldBehaviours fieldBehaviours
def A= getFieldById("customfield_10109")
def B= getFieldById("customfield_10120")
def C= getFieldById("customfield_10018")
def D= getFieldById("customfield_10019")
def E= getFieldById("customfield_10201")
//def F= getFieldById("customfield_10124")
//def G= getFieldById("customfield_10203")
//def H= getFieldById("customfield_10204")
//def I= getFieldById("customfield_10201")
//def F= getFieldById("customfield_10206")
//def J= getFieldById("customfield_10205")
if (A.getValue() == "aaaa"){
B.setHidden(false);
C.setHidden(false);
D.setHidden(false);
E.setHidden(false);
}
if (A.getValue() == null){
A.setHidden(true);
B.setHidden(true);
C.setHidden(true);
D.setHidden(true);
}
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.