In a "Create Issue" screen I am trying to hide a custom field based on a value of a group picker field. The field should be hidden for all groups apart from a particular group.
I am using the Scriptrunner Behavior plugin.
// Group ID is the group picker field
FormField fieldFF = getFieldByName("Group ID");
String fieldValue = fieldFF.getValue();
if(!"Some Special Group".equals(fieldValue)){
FormField fieldToHideFF = getFieldByName("Initial Severity");
fieldToHideFF.setHidden(true);
}
However when adding both fields to the behavior this does not work. I am setting the group picker field via a http GET parameter.
Thanks in advance!
Edit: Added problem statement
And what is the problem? You should add the Group Id field to your behaviour and add this script for the field. Do you have any errors?
Sorry, I updated the question. Even when adding both fields to the behavior the field is not displayed when the group picker is set to "Some Special Group".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Behaviours do not work with http calls
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know. I merely use the http call to fill the value of a group picker field. Based on the filled in value I need to hide or show a certain other field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you add logging to your script and have a look in the logs?
FormField fieldFF = getFieldByName("Group ID");
log.error("fieldFF: " + fieldFF)
String fieldValue = fieldFF.getValue();
log.error("fieldFF value: " + fieldValue)
if(!"Some Special Group".equals(fieldValue)){
log.error("in condition")
FormField fieldToHideFF = getFieldByName("Initial Severity");
log.error("fieldToHideFF: " + fieldToHideFF)
fieldToHideFF.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.