Hi,
In Jira server, I try to set the priorty field according the value of two custom fields : Criticity and Impact. For that, I use behaviours (script runner). Currently, my script set the priority field correctly, but I can't set it when the user selects the values in the custom fields (dynamically).
Here is my code :
def fCriticity = getFieldById( "customfield_10600" )
def fImpact = getFieldById( "customfield_10601" )
def fpriority = getFieldById( "priority" )
def fpriority0 = getFieldById( "priority-field" )
fpriority.setReadOnly( true )
String vCriticity = (String) fCriticity .getValue()
String vImpact = (String) fImpact.getValue()
if ( ( vCriticity == "Block" ) && ( vImpact == "Strong" ) )
{
fpriority.setFormValue( 1 )
fpriority0.setFormValue( "Very high" )
}
if ( ( vCriticity == "Block" ) && ( vImpact == "Medium" ) )
{
fpriority.setFormValue( 2 )
fpriority0.setFormValue( "High" )
}
if ( ( vCriticity == "Block" ) && ( vImpact == "Low" ) )
{
fpriority.setFormValue( 3 )
fpriority0.setFormValue( "Medium" )
}
if ( ( vCriticity == "Major" ) && ( vImpact == "Strong" ) )
{
fpriority.setFormValue( 2 )
fpriority0.setFormValue( "High" )
}
if ( ( vCriticity == "Major" ) && ( vImpact == "Medium" ) )
{
fpriority.setFormValue( 3 )
fpriority0.setFormValue( "Medium" )
}
if ( ( vCriticity == "Major" ) && ( vImpact == "Low" ) )
{
fpriority.setFormValue( 4 )
fpriority0.setFormValue( "Low" )
}
if ( ( vCriticite == "Minor" ) && ( vImpact == "Strong" ) )
{
fpriority.setFormValue( 3 )
fpriority0.setFormValue( "Medium" )
}
if ( ( vCriticity == "Minor" ) && ( vImpact == "Medium" ) )
{
fpriority.setFormValue( 4 )
fpriority0.setFormValue( "Low" )
}
if ( ( vCriticity == "Minor" ) && ( vImpact == "Low" ) )
{
fpriority.setFormValue( 4 )
fpriority0.setFormValue( "Low" )
}
I tried with underlying, but nothing works.
Could you help me please ?
Thank you.
Nath