The Task is on creating issue assign to one of a project roles based on the reporter.
I test this script below in a script console with a given issue I work fine but when I put it in a post-function is not working the assignee did not change.
Can someone help me, this is the code
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
//def issue = issueManager.getIssueObject("BDI-5")
ProjectRoleManager projectRoleManager = ComponentAccessor.getComponentOfType(ProjectRoleManager.class) as ProjectRoleManager
def groupManager = ComponentAccessor.getGroupManager()
// Get any role
ProjectRole PMOR = projectRoleManager.getProjectRole("Administrators")
ProjectRoleActors PMOActors = projectRoleManager.getProjectRoleActors(PMOR, issue.getProjectObject())
def PMOAssignee = PMOActors.getUsers().toList().first().username
log.warn("to see "+PMOAssignee)
def issueService = ComponentAccessor.getIssueService()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def validateAssignResult = issueService.validateAssign(user, issue.id, PMOAssignee)
I changed the post-function to different order still the same, no error found the script working but the assignee did not change, it seems like in post-function he didn't get the current issue I tried also to add this line in the end "issue.store()" still have the same
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events