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.

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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