Hello All,
I have hided custom fields on selection of other custom field value section with the below script in behavior.
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def myrequestclassField = getFieldById(getFieldChanged())
def valueField = getFieldByName("Branding")
String myrequestclassValue = myrequestclassField.getValue()
if (myrequestclassValue == "Folder Structure and File Move Request") {
valueField.setHidden(true)
} else {
valueField.setHidden(false)
}
But this is not working for Priority field(system field).
can any one please help.
Thanks,
Mani
For priority and other system fields, you'll want to use:
getCustomFieldById('priority')
Or, you can use the IssueFieldConstants class if you want to use autocomplete:
import com.atlassian.jira.issue.IssueFieldConstants
getCustomFieldById(IssueFieldConstants.PRIORITY)
Hi Peter,
Thanks for your help!
I have tried above solution, but no luck. Could you please check my below script??
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def myrequestclassField = getCustomFieldById(getFieldChanged())
def valueField = getCustomFieldById('priority')
String myrequestclassValue = myrequestclassField.getValue()
if (myrequestclassValue == "Folder Structure and File Move Request") {
valueField.setHidden(true)
} else {
valueField.setHidden(false)
}
Error - "Cannot find matching method"
Thanks again,
Mani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, bad cut and paste on my part.
It should be
def priorityField = getFileById(‘priority’)
def priorityVal = priorityField.value
I don’t recall what type of value you will get from this. It may just be the priority id. And then you may have to get the value from somewhere else. Or else find the I’d for your priority and compare against that.
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.