Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Make Inactive when State is Cancelled

SNOW46
Tera Contributor

Hi Guys,

I have a doubt that I want to make the Incident as Inactive once the state is changed to Cancelled.

Please let me know on this how to achieve this functionality.

 

 

 

Regards,

Gourav

4 REPLIES 4

Jotiram Yadav
Tera Expert

Write a BR which checks if state is cancelled. If yes change the field, active to "false".

BR would be before update.

if(current.state.changesTo('cancelled')){ // instead of cancelled use actual value

current.active = false;

 }

Hope this helps.

 

hit Like / helpful / answered as applicable.

 

kind Regards,

Jotiram

Hi,

 

You don't require to use business rule here .This can be achieved using on-change client side script.

 

Thanks ,

 

Mahesh Gupta

Ujjawal Vishnoi
Mega Sage

Hi,

 You can write BR to achieve this without any script. Please refer the screen shot below.

find_real_file.png

 

find_real_file.png

 

Hope this helps.

 

Regards

Ujjawal

 

Gajanan Birada1
Giga Expert

hi,

If you want achieve this using on change client script .you have to write logic like this

//onchange client script 

 

if(newValue=='cancelled')//state field value 
{

g_form.setValue('active',false)); 


}

Thank You

Gajanan Biradar