You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I would like to do check new customer accounts (when their first ticket is created) for a specific email group (i.e. find anyone with an email address from "@example.com") and add them to a specific group.
I have ScriptRunner installed, but I have searched all through their tutorials and examples and can't seem to find anything that would solve this problem. I think it would be as simple as putting a script in the create post function with the following logic:
if email address included "@example.com" then
set group = "distributors"
The part that I can't find is how to look at the email address of a customer/reporter.
Hi @Paul Mata ,
yes, custom script post-function on create transition should work, please try something like this:
import com.atlassian.crowd.embedded.api.Group
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.groups.GroupManager
import com.atlassian.jira.user.ApplicationUser
String USER_GROUP_NAME = "distributors"
String USER_EMAIL_PATTERN = "@example.com"
GroupManager groupManager = ComponentAccessor.getGroupManager()
ApplicationUser reporter = issue.getReporter()
if (reporter.getEmailAddress().contains(USER_EMAIL_PATTERN)) {
Group group = groupManager.getGroup(USER_GROUP_NAME)
if (!groupManager.isUserInGroup(reporter, group)) {
groupManager.addUserToGroup(reporter, group)
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan. &nb...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.