custom ScriptRunner post function on transition Start Progress shows as successful but only updates Assignee field during normal JIRA transition. When create branch trigger executes the assingee value remains unassigned (not changing) and validator Required fields: Acceptance Criteria is also bypassed.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
// Get the current user
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def Issue issue = issue
if (currentUser != issue.assignee) {
issue.assignee = currentUser
}
Hey Anj!
So this is just a hunch at this point, but it may be that your script is being executed, but the changed asignee isn't being persisted to the JIRA database. Could you go ahead and try this code? I've made a couple of edits to ensure that the changes are indexed:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.Issue
def issueManager = ComponentAccessor.issueManager
// Get the current user
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def Issue issue = issue
if (currentUser != issue.assignee) {
issue.assignee = currentUser
//Persist the assignee change to the DB
issueManager.updateIssue(currentUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
}
Try that script out and let me know what you find! :)
If it doesn't change anything, we may have to look a little further into the problem.
-Aidan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Aidan. I tried the code and the record remained unassigned when I create branch but auto assigns during normal JIRA worfklow. Thanks for trying though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.