You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.
Join groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
We have scriptrunner. I'm using a Behaviour to lock a field for editing. There is an exception. If a user is a part of a specific group, the field can be edited. If the user is not in that group, the field is locked.
Is there a way to show some helper text to a user not in the group that the field is locked because they're not in the group?
This code should do it for you:
import com.atlassian.jira.component.ComponentAccessor;
final String permittedGroup = "GROUP";
final String protectedField = "Field";
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
def groupManager = ComponentAccessor.getGroupManager();
def valid = groupManager.getGroupsForUser(currentUser).find {it.getName() == permittedGroup}
def field = getFieldByName(protectedField);
if (valid == null) {
field.setDescription("Only members of $permittedGroup can edit this field");
field.setReadOnly(true);
} else {
field.setDescription("Please edit this field");
field.setReadOnly(false);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Calling all Confluence Cloud Admins! We created a new Community Group to support your unique needs as Confluence admins. This is a group where you can ask questions, access resou...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.