I am trying to find out if I can disable the editing of a field when it is in a particular status. I have scriptrunner and wanted to know if this can be done with the scriptrunner behaviors.
import com.atlassian.jira.component.ComponentAccessor
def field = getFieldByName("Priority Number")
def customField = customFieldManager.getCustomFieldObject(field.getFieldId())
def fieldConfig = customField.getRelevantConfig(getIssueContext())
if (issueContext.projectObject.key != "INNP"){
field.setReadOnly(true)
}
You don't know what the syntax for that would be do you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
def issueStatus = issue.getStatus().getName()
See what that gets you.
VIA: https://community.atlassian.com/t5/Jira-Software-questions/Scriptrunner-listener-get-current-issue-data/qaq-p/1931114
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.
New to scripting. Something like this @Judah ?
import com.atlassian.jira.component.ComponentAccessor
def field = getFieldByName("Original Due Date")
def customField = customFieldManager.getCustomFieldObject(field.getFieldId())
def fieldConfig = customField.getRelevantConfig(getIssueContext())
def issueStatus = issue.getStatus().getName()
if (issueStatus = “Development”){
field.setReadOnly(true)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Joe Harmon I tweaked yours a little and got the below to work on my instance.
import com.atlassian.jira.component.ComponentAccessor
def issueManager = ComponentAccessor.getIssueManager()
def issue = underlyingIssue
def field = getFieldByName("Story Points")
def issueStatus = issue.getStatus().getName()
if (issueStatus == "Ready for Development"){
field.setReadOnly(true)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You will need to change the field name and the status name, but that should do the trick
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.
That is correct
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please let me know if it works
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.
Hi @Joe Harmon
This article here does not say how to do it with Scriptrunner but might give you some ideas how this can be achieved without Scriptrunner.
HTH,
KGM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah those aren't going to work for me, but thanks for the suggestion. I know there is a way to set a field to read only with scriptrunner behaviors, but trying to find good script examples of doing that during while only in a certain status.
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.