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)
}