Hi All,
I have a script in place which checks, if a customfield (single-user-picker) is set or not.
...
...
def currentAppUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().name
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("ASD: On behalf of")
def newReporter = issue.getCustomFieldValue(customField) as ApplicationUser
if (customField){
issue.setReporter(newReporter)
} else if (!customField){
log.info("Reach else tree")
issue.ReporterId = currentAppUser
}
ComponentAccessor.getIssueManager().updateIssue(issue.getReporter(), issue, EventDispatchOption.ISSUE_UPDATED, false)
The if condition works fine and the reporter will be replaced but unfortunately the else statement will never be executed. Instead of the currentAppUser the ticket creates "Anonymous" as a reporter.
Any suggestions?
Best,
Kristian