Forums

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

Script Runner Behaviour validation help

Jagadeesh Chander March 4, 2023

Team, I have written a behavior script in Jira that will validate

the following condition

I am having field called GTPI program increment

whenever I change the value in the field first condition will fire

in my behavior script, it will show a value in the comment field

as 'spill Over'

Same when I remove the field value from the GTPI program increment
the second condition will work and will show a value in the comment field

as 'Remove from PI'

now the problem is now when again i try to select a value in

GTPI program increment i am getting the message as 'spill Over'


in this case i need to clear the value in the comment feild or hide it can anyone help with this 3 conditions my script is below


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

import groovy.transform.BaseScript


@BaseScript FieldBehaviours behaviours

def Source= getFieldById(fieldChanged)
def sourceValue = Source.toString()

 

 

 

def defaultValue = "Spill Over From PI "

def defaultvalue1 = "Removed from PI"

def fixed = sourceValue

def RCAfield= getFieldByName('Comment Spill over')
def RCAfield1= getFieldByName('Spill over')
// RCAfield.required = true
// RCAfield.hidden = false
// RCAfield1.required = true
// RCAfield1.hidden = false
// RCAfield.setFormValue("Removed from PI")
// RCAfield1.setFormValue("None")

 

if(sourceValue.contains('GT') || sourceValue.startsWith('GT') ) {
RCAfield.required = true
RCAfield.hidden = false
RCAfield.setFormValue('spill Over')
RCAfield1.required = true
RCAfield1.hidden = false
RCAfield1.setFormValue('None')
}
else if(sourceValue.contains('')|| sourceValue.startsWith('') ) {
RCAfield.required = true
RCAfield.hidden = false
RCAfield.setFormValue('Removed from PI')
RCAfield1.required = true
RCAfield1.hidden = false
RCAfield1.setFormValue('None')

}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events