User Tools

Site Tools


validators

This is an old revision of the document!


Scripted Validators

Following scripts can be used for scripted validators within the workflow

Verify project name

issue.projectObject.name == "My First Project Name"

Require Value in FIELD2 if FIELD1 = 'Yes'

if ( cfValues['FIELD1']?.value == 'Yes') { 
    if ( cfValues['FIELD2'] ) {
        return true
    } 
    else return false
     }
 else return true

Require Value in DATEFIELD2 greater than "NOW" if FIELD1 is set

Date today123 = new Date()
if ( cfValues['FIELD1'] ) { 
    if ( cfValues['DATEFIELD2'].getTime() > today123.getTime() ) {
        return true
    } 
    else return false
     }
 else return true

Check if field equals some string

def selectedSegment = cfValues['Segment']
def selectedSegmentString = selectedSegment.toString()
if ( selectedSegmentString.equals("Some String") ){
    // do something here
 
}
validators.1516127340.txt.gz · Last modified: 2018/01/16 13:29 by pawel