Hello,
I wish set automatically the approvers based on another customfield (DropDown List)
I put the following script in the Behavior:
when i test as a jira agent from the portal , the script works correctly and the user is setted in the approver field
But when i test as a customer from the portal , nothing happen and the approver field is still empty.
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
@BaseScript FieldBehaviours fieldBehaviours
def customefield = getFieldById(getFieldChanged())
def Approvers = getFieldByName("Approvers")
Approvers.setFormValue(null)
switch (customefield.getValue()) {
case "A":
Approvers.setFormValue(["user1"])
break
case "B":
Approvers.setFormValue(["user2"])
break
}
Please Help