I am trying to set value to a field or trying to hide a field for my project using groovy script or by enabling readonly button in Behaviour. But not working.
Please help me to fix this.
Hi Pramod_Kumar_Ojha,
Do you need to exclude The "DataCenter Link" from your screen?You can do it by many way
- Create new screen for your sub-task and remove this field from your screen
- Create a Field Configuration for your sub-task then hidden the field by Field Configuration
- Set Custom Field context to exclude your issue type.
- Set Hidden for this field only in the ScriptRunner Behaviour
Hope this helps!
Hi @Pramod.Kumar.Ojha
could you please try like this:
getFieldByName('DataCentre Link').setReadOnly(true)
Hello @Pramod.Kumar.Ojha ,You may not require the component accessor line here. Can you check with below script based on your requirement - If type is Race Subtask then readonly to duration and dclink field as hidden.
def issueTypeField = getFieldById("issuetype")def currentIssueType = issueTypeField.getValue()// Fields to manipulatedef durationField = getFieldByName("Estimated Duration (w)")def dcLinkField = getFieldByName("DataCenter Link")if (currentIssueType == "Rack Sub-task") {// Make duration field read-onlydurationField.setReadOnly(true)// Hide DataCenter Link fielddcLinkField.setHidden(true)// Optionally set a default valuedurationField.setFormValue("5")} else {// Reset to writable and visible if not "Rack Sub-task"durationField.setReadOnly(false)dcLinkField.setHidden(false)}
not working.
Its not working.
I already have working code which is working in Staging environment. But same code is not working in production.
Any sort of error or something else you can share?
We are not getting any error.
It looks like you're new here. Sign in or register to get started.