Hi,
I'm trying to set an option in a select field if the reporter is in a specific group but I always get this error.
java.lang.NullPointerException: Cannot set property 'Segmentation' on null object
I tried multiple ways but always with a similar error. This is the latest version I have:
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def groupManager = ComponentAccessor.getGroupManager()
def segment = getFieldById("Segmentation")
def reporter = issue.getReporter()
if (groupManager.isUserInGroup(reporter, "sales-segment-KIA"))
{
segment.setFormValue(13500)
}
Hello @Kevin Verheyden
To set the option, can you use optionsManager to get the list of option and then set the right option.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Kevin Verheyden
The example is also about setting a specific option on the select list custom field, the code in the example will not a new option to the select list rather it will fetch the exact option object based on the option name you supply in the code
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.