Restrict Custom field values with Scriptrunner Cloud

Jesus Octavio Gutierrez Villegas
Contributor
August 1, 2024

Hi everyone,

 

First, thanks for taking the time to read and answer.

My goal is to restric the selection of a certain value in any customfield, per group or user role.

for example, for my customfield_1435 I have 4 options: A, B, C and D. I dont want my users with developer role to select option B.

is it possible?

1 answer

1 vote
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2024

Hello @Jesus Octavio Gutierrez Villegas 

Do you want this limitation to apply only when the issue is created, or also when the issue is being viewed/edited after creation?

What if the user is assigned to more than one Role?

Jesus Octavio Gutierrez Villegas
Contributor
August 5, 2024

Hi Trudy,

Thanks for your answer, I did a work around, with a transition to same status, visually on actions you have a new button that will open a pop up with the required field, and added validation for user role to certain value like this:

issue.customfield_16129.value == "4.0" &&
user.getProjectRoles(issue.project).some(pr => pr.name == "Administrator") ||
issue.customfield_16129.value != "4.0"

Also this validation is present on create issue transition.

The goal is to allow only admins to create new or edit current issues with this value, any other role cannot. when creating, viewing/editing.

Thanks again, this works for us now, but if you have another idea i would love to learn!

Like Trudy Claspill likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events