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.
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.