Hi,
I have checkbox named 'Control Release' checkbox and I want to make this field enable for user who is in 'Control Release Owner' field on certain workflow statuses.
How to do that?
Any help would be appreciated..
Hi @Teja,
So, the users, except the control release owner, will see the control release cf as read-only.
Tansu Akdeniz
So the "Control Release" [checkbox], will always available to "Control Release Owner".
May be I was not clear, I will explain with the example.
When the issue in 'Created' , 'Requested' status "Control Release" [checkbox] should always be disabled include "Control Release Owner" and when the issue in 'Control Release' status, then "Control Release" [checkbox] enabled for "Control Release Owner" only.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Teja
You can add a groovy code in behaviours section like this;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.user.ApplicationUser;
def issueId = getFieldById("id")
def controlReleaseCheckbox = getFieldById(getFieldChanged());
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def customFieldManager = ComponentAccessor.getCustomFieldManager();
Issue issue = ComponentAccessor.getIssueManager().getIssueObject(issueId.getValue() as Long);
String currentUserName = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getName();
CustomField controlReleaseUserCF = customFieldManager.getCustomFieldObject("customfield_10136");
def controlReleaseUser = issue.getCustomFieldValue(controlReleaseUserCF);
if(issue.getStatusId().equals("12345")){ //Control Release Status
if(currentUserName.equals(controlReleaseUser.getName())){
controlReleaseCheckbox.setReadOnly(false)
} else{
controlReleaseCheckbox.setReadOnly(true)
}
} else{
controlReleaseCheckbox.setReadOnly(true)
}
Tansu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tansu Akdeniz,
Thanks for you script.
I tried this in fields server-side script but I am getting error and not working as expected.
I shared screen shot.
And why are we using particular issueid instead of issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Teja,
You must leave this line as below;
def issueId = getFieldById("id")
When you load a transition/edit pop-up, script gets the id of an issue with "id" parameter. Do not change it :) It should work.
Example; https://scriptrunner.adaptavist.com/4.3.5/jira/recipes/behaviours/subtask-default-fields.html
Tansu Akdeniz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.
Register here ⬇️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.