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.
×Hi,
We want to send a "Welcome" email when user get access to jira (ie added to specific group).
We don't have specific plugin yet but using something like ScriptRunner is an option.
Can someone give me a solution on how to do that?
I finally got a solution with your help.
Running ScriptRunner Listener "Send a custom email (non-issue events)" on event "GroupMembershipCreatedEvent" with this script in the Condition and Configuration parameter
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
def userManager = ComponentAccessor.getUserManager() as UserManager
def user = userManager.getUserByName(event.getEntityName())
mail.setTo(user.emailAddress)
def result = false
if(event.getGroupName() == "jira-users") {
result = true
}
return result
You can create a Listener "Send a custom email (non-issue events)"
Apply to Global
Events: GroupMembershipCreatedEvent
Condition and Configuration:
result = false
if(event.getGroupName() == "YOURGROUPNAME"){
result = true
}
return result
Then you can configure the template of the object and body.
You can access some information such the username of the user using $event.getEntityName() in the template.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. I've just installed a trial version of scriptrunner but using the listener you mention, I can't find how to specify the "current" user as the recepient of the email.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can configure the To: address dynamically by supplying a script in the Condition and Configuration parameter
E.g to send an email to the current logged in user you would do something like this:
mail.to = currentUser?.emailAddress
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud, our FedRAMP Moderate offering, is coming soon! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.