You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi All,
what should be the script for project role(like: Tester) condition on transition?
Means, only testers would be visible on particular transition.
I was trying this : isUserMemberOfRole('Testers') , but it's not working.
Thanks.
Hi @Admin You are trying to set up a condition, users which are in Tester project role only have permission to transition this issue, right ?
Instead of writing a scripted condition, you can this Condition Project role(s) condition [ScriptRunner] : Allows the transition if the current user is, or is not, a member of the specified project role(s).
yes , this condition is working , but I want to try through writing the script i.e , inline script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Admin I think you are trying to add Custom Scripted Condition, for this try below script :-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def projectRoleManager = ComponentAccessor.getComponentOfType(com.atlassian.jira.security.roles.ProjectRoleManager)
def testerRole = projectRoleManager.getProjectRole("Tester")
def project = issue.getProjectObject()
def userInTesterRole = projectRoleManager.isUserInProjectRole(currentUser, testerRole, project)
log.warn userInTesterRole
passesCondition = userInTesterRole
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes its working , but could you please exlain the code step by step that will be very clear understanding for me or else we can able to write next condition or something by ourself.
Thank You very much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Admin Glad to hear I am able to help you out! Kindly accept the solution, if works for you as it helps other users looking for same solution.
Detailed Description :-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
//get Current User/logged in User
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
//get project roles
def projectRoleManager = ComponentAccessor.getComponentOfType(com.atlassian.jira.security.roles.ProjectRoleManager)
//get Tester roles from Project Roles
def testerRole = projectRoleManager.getProjectRole("Tester")
//get Project Key
def project = issue.getProjectObject()
//check if user in Tester project role or not, it gives true or false value and value stores in variable userInTesterRole
def userInTesterRole = projectRoleManager.isUserInProjectRole(currentUser, testerRole, project)
log.warn userInTesterRole
//pass condition if userInTesterRole is true , fail if userInTesterRole is false
passesCondition = userInTesterRole
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.
Hi @Admin kindly accept the solution.
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.
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.