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.ComponentAccessorimport com.atlassian.jira.user.util.UserManagerdef userManager = ComponentAccessor.getUserManager() as UserManagerdef user = userManager.getUserByName(event.getEntityName())mail.setTo(user.emailAddress)def result = falseif(event.getGroupName() == "jira-users") { result = true}return result
Hi @Bertrand Delaitre
You can create a Listener "Send a custom email (non-issue events)"
Apply to Global
Events: GroupMembershipCreatedEvent
Condition and Configuration:
result = falseif(event.getGroupName() == "YOURGROUPNAME"){result = true}return result
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
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 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
It looks like you're new here. Sign in or register to get started.