Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Behaviours - scriptrunner get user and project role

Mauricio Rodriguez
Contributor
February 21, 2025

Hi everyone,

I need to create a behavior in ScriptRunner that retrieves the current user and then checks their role in the Jira project where they are trying to create an issue. I appreciate your help in determining whether this can be achieved in Jira Cloud.

3 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Kristian Walker _Adaptavist_
Community Champion
February 24, 2025

Hi Mauricio,

I can confirm with Behaviours in Jira Cloud you need to retrieve the roles from the context to check them.

We have a couple of example scripts in the docs linked below that show how to do this that you can use as a guide to help create the script that you require.

Examples: 

 

I hope this helps.

Regards,

Kristian

0 votes
Mohamed Benziane
Community Champion
February 22, 2025

Hi,

I think you will need to retrieve the project role used by the current project then iterate over each role and search for the current user in each role.

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-roles#api-group-project-roles

in behaviour you can use the getContext method to access the current project and more infos

https://docs.adaptavist.com/sr4jc/latest/features/behaviours/behaviours-api

Mauricio Rodriguez
Contributor
February 22, 2025

Hi Mohamed. Thank you so much. I'll try your suggestions. 

Regards. 😀 

Like Mohamed Benziane likes this
0 votes
Petru Simion _Simitech Ltd__
Atlassian Partner
February 21, 2025

Hi @Mauricio Rodriguez ,

 

It is unclear what you mean by "checks their role".

If you are open to using apps, you can use Roles Dashboard for Jira , an app released by our company.

In the two perspectives, you can have a clear picture of how your user is part of roles, either by being assigned to a role directly, or by being part of a group that is assigned to the role.

 

roles_dashboard_project_user_role_perspective.pngroles_dashboard_user_role_project_perspective.png

 

You can export your result to csv for further analysis.

 

Regards, 

 

Petru

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events