HI team, i am unable to update the assignee field on the basis of another field using post function

shrikant maheshwari May 20, 2020

Hi Team, 

I am trying to update "Assignee" field based on the another field named as "Incident Assignee" on a  specific transition and has written a script in the post function. The script is not giving any error but the assignee field is not getting updated in the screen even though in the history tab i can see that the assignee has been updated. pfb script written -

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import org.apache.log4j.Category
import com.atlassian.jira.issue.MutableIssue
import org.apache.log4j.Logger
import org.apache.log4j.Level
log.setLevel(Level.INFO)

def issueManager = ComponentAccessor.getIssueManager();

def issueService = ComponentAccessor.getIssueService();

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def cf = customFieldManager.getCustomFieldObjectByName("Incident Assignee");

def cfv = issue.getCustomFieldValue(cf);

log.info (cfv)

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def validateAssignResult = issueService.validateAssign(user, issue.id, issue.reporterId)

issueService.assign(cfv, validateAssignResult)
issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events