Hi!
I'm using the following Groovy Code through a Script Listener what perfectly does the Job.
Long EVENT_ID = new Long("10300")
ApplicationUser currentUser
IssueEventBundle eventBundle
JiraAuthenticationContext jiraAuthContext = ComponentAccessor.getJiraAuthenticationContext()
IssueEventManager issueEventM = ComponentAccessor.getIssueEventManager()
IssueEventBundleFactory issueEventFactory = (IssueEventBundleFactory) ComponentAccessor.getComponent(IssueEventBundleFactory.class)
currentUser = jiraAuthContext.getUser()
eventBundle = issueEventFactory.wrapInBundle(new IssueEvent (issue, null, currentUser, EVENT_ID, true))
issueEventM.dispatchEvent(eventBundle)
Basically the Code triggers an email in the end and my only remaining requirement is that the email's Sender is NOT the current logged in user (current state with implementation).
The email's Sender should be "Helpdesk", therefore I even created an user "Helpdesk" with appropriate application Access and even assigned a valid mail address to it but when the mail is send by the Code above the Sender is still the currently logged in user.
I tried to Change the ApplicationUser currentUser line but to no avail.
I appreciate any hint. Thanks in advance!
Best regards,
Birgit
Have you tried UserManager Class? It has "getUserByName" method which gives ApplicationUser object.
def userManager = ComponentAccessor.getUserManager()
ApplicationUser helpDeskUser = userManager.getUserByName("helpdeskUsername")
Then you can user helpDeskUser instead of 'currentUser' in your script.
That worked out perfectly for our use case also. Many thanks!
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.