I been struggling for a week to figure out why i cant get this script to work.
i have 2 customfields, one with a system list, and one with an employee list.
If a system is choosen i want to autopopulate the employee list with the system approvers that is added for the system, and also be able to add more users.
My script so far. ( i'm not a coder, bear with me)
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.riadalabs.jira.plugins.insight.services.model.ObjectAttributeBean
import com.riadalabs.jira.plugins.insight.services.model.ObjectAttributeValueBean
import groovy.transform.BaseScript
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade
@PluginModule ObjectTypeAttributeFacade ObjectTypeAttributeFacade // systemchoice customfield_12800
// approver customfield_12803
def CustomFieldManager = ComponentAccessor.getCustomFieldManager()
def System =CustomFieldManager.getCustomFieldObject(customfield_12800)
def Approver = CustomFieldManager.getCustomFieldObject(customfield_12803)
def SystemApprover = 'System approver'
// Set approver with 'system approver'
def SystemObject = ObjectFacade.loadObjectBean(System[0])
def approverAttribute = ObjectTypeAttributeFacade.loadObjectTypeAttribute(systemObject.objectTypeId, SystemApprover)
def ObjectAttribute = SystemObject.objectAttributeBean.find{ it.objectTypeAttributeId == approverAttribute.id }
def ApproverUsers = ObjectAttribute.objectAttributeValueBeans.collect{Name.value as String}
Approver.setFormValue(ApproverUsers)
log.warn(Approver : ApproverUsers)
Any ideas?