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 MutableIssuedef 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)
It looks like you're new here. Sign in or register to get started.