Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding custom field on transition screen

Jarrett
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!
April 10, 2025 edited

I'm trying to hide or show a custom filed on a transition screen based on the value of a custom field in the underlying issue.  I'm using a ScriptRunner behavior to accomplish this.  I am first checking if its the correct transition screen then if the trigger field matches I show the field.  if not then its hidden. 

here is the code and the logs I get when the code is executed.  I cant figure out why TriggerField1 =='Name Check' is equal to false. 


 

import groovy.transform.BaseScript

import com.onresolve.jira.groovy.user.FieldBehaviours

@BaseScript FieldBehaviours fieldBehaviours

final String screenName = 'OSIAP First lvl completed Reviewed by'

//def triggerField = getFieldById('customfield_13022') //Product SubType

if (fieldScreen.name == screenName) {    

  def fieldtoHide = getFieldById('customfield_13800')

  def triggerField1 = underlyingIssue.getCustomFieldValue('Product Subtype')

 

  log.warn(triggerField1)

  log.warn(triggerField1 == 'Name Check')

   

      if (triggerField1 == 'Name Check') {

          fieldtoHide.setHidden(false)

          fieldtoHide.setRequired(true)

           log.warn('its working now')

      } else {

          fieldtoHide.setHidden(true)

          fieldtoHide.setRequired(false)

          log.warn('not working')          

      }            

}



 

 

and here is the log info

 

 

2025-04-10T11:45:34,782 WARN [runner.ScriptBindingsManager]: Name Check 2025-04-10T11:45:34,783 WARN [runner.ScriptBindingsManager]: false 2025-04-10T11:45:34,783 WARN [runner.ScriptBindingsManager]: not working

1 answer

1 accepted

0 votes
Answer accepted
Jarrett
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!
April 10, 2025

for anyone in the future I figured it out.  It was a simple data mismatch.  I changed the triggerField1 value to a string and its working. 

final String triggerField1 = underlyingIssue.getCustomFieldValue('Product Subtype')

 

Suggest an answer

Log in or Sign up to answer