Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×We have a customer email field (text single line) that is being filled by users while creating feedback on JIRA. We need to create a post-function which will automatically set the Reporter based on the inputs of this text field. Is there a simple groovy script available which we can refer? Thanks for your help.
Hi debraj.neogi@tesco.com
You can take this as a reference, I'm using ScriptRunner.
def userManager = ComponentAccessor.getComponent(UserSearchService)
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
IssueManager issueMAnager = ComponentAccessor.getIssueManager()
def issue = issue as MutableIssue
def emailField = customFieldManager.getCustomFieldObjectByName("email")
def email = issue.getCustomFieldValue(emailField)
ApplicationUser reporter = userManager.findUsersByEmail(email.toString()).getAt(0)
issue.setReporter(reporter)
issueManager.updateIssue(user,issue,EventDispatchOption.DO_NOT_DISPATCH,false)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.