Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,362,538
Community Members
 
Community Events
168
Community Groups

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

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 comments

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events