Hi All,
We have a requirement where we would need to assign issues to the reporter, if the reporter belongs only to one specific role. Could someone help with the scripted post function for the same.
Assume, if the reporter is a 'Tester' then the issue needs to be assigned to him. If he has any other different role, then the assignment should not work.
Regards
Niran
Hello @Niranjan
You can use ScriptRunner to achieve this goal and scripted postfunction like this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager.class)
if (projectRoleManager.getProjectRoles(issue.getReporter(), issue.getProjectObject()).any {it.name = "Testers"}){
issue.setAssignee(issue.getReporter())
}
Hi @Mark Markov ,
Thanks for your response. The script throws an error
Cannot set read-only property: name
Any thoughts? Thanks
Regards
Niran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager.class)
if (projectRoleManager.getProjectRoles(issue.getReporter(), issue.getProjectObject()).any {it.name == "Testers"}){
issue.setAssignee(issue.getReporter())
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You can use the Power Scripts add-on to accomplish this task.
https://marketplace.atlassian.com/apps/43318/power-scripts-jira-script-automation
There is a 30 days trial period for the plugin.
Your post function would look like this:
if (isUserInRole(currentUser()
, project
,
"Testers"
)
)
assignee = reporter;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!
Join an Atlassian Community Event!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.