Custom Field Restriction

Omar Sodan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 16, 2024

Hello,

We are using JSW DC and we have been facing some sort of a challenge and we could use some help.

First of all we are working over one project where 50+ user "Divided into user groups" and users take action over the issues based on the status of the Issue.

We have a dropdown custom field "Z" in the project and we need to block the edit over the field value unless the editor is in a specific user group which will be determined by the current status.

For example,
Status X is handled by user group A
Then if it got switched to Status Y then user group B will start working over it and so on till we reach status DONE!

Any Help ? even if it will include an add-on.

2 answers

0 votes
Matt Parks
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2024

If you have Scriptrunner, you can create behaviors that can conditionally make fields editable by groups. Here's an example of a behavior that I'm using. I have a custom field called AVP Approval and I only want it to be editable by users in the GRP-S-Salesforce AVP Approval Team group while the work item is in the UAT status.

 

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def avpAppField = getFieldByName("AVP Approval")
def issueStatus = underlyingIssue.getStatus().name
def issueType = underlyingIssue.getIssueType().name

avpAppField.setReadOnly(true)
   

if (ComponentAccessor.getGroupManager().getGroupsForUser(currentUser)?.find { it.name == "GRP-S-Salesforce AVP Approval Team" } && issueStatus == "UAT")
{
    avpAppField.setReadOnly(false)
}
Matt Parks
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2024

Behaviors also allow you to set conditions based on groups and workflow status/transition without scripting, but sometimes I can't do what I want without scripting. In the above script, there are also some other custom fields that have to have certain values, but I removed those from the example script because they weren't important to your question.

Matt Parks
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2024

You can do something similar with Project Roles as well (instead of groups).

0 votes
Dave Mathijs
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2024

Hi @Omar Sodan Welcome to the Atlassian Community!

Please read through the following knowledge base article:

How to only allow certain fields to be editable depending on Status

Omar Sodan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 16, 2024

Hello @Dave Mathijs Thanks for your fast reply.

However, we're not looking for creating new screens we are done with this part.

We just need to control that if issue status = Development then only users in group "Developers" can edit this field value

and when the issue is transitioned to status Testing for example then only users in group "QA" can edit the field.

Suggest an answer

Log in or Sign up to answer