How to run a business rule on change of the field in the form

Learn SN
Tera Contributor

Hello experts,

 

I have a question, 

I want that when a user changes the value of a field on incident form, a business rule is called.

 

I know it is easy to do with client script ( onchange type) , but in my case, I want a business rule to be called.

 

Can someone please help ?

 

 

Thanks!

 

13 REPLIES 13

Pranay Tiwari
Kilo Guru

if(current.field_name != previous.field_name)
{
current.description = previous.short_description; //Action you want to perform on change the value
}

 

it will definitely work as onChange.

 

Mark correct or helpful if it helps you.

 

 

 

 

Please don't do it.. Use changes() instead..

if(current.field_name.changes())
{
current.description = previous.short_description; //Action you want to perform on change the value
}

Peter6
Kilo Contributor

Did you ever find a way to run server scripts when a field changes without having to submit the form?

Tobias11
Kilo Contributor

You can use the GlideAjax for such a case when you want to trigger a server side script with an action you took on the UI.

You will need a client script and a script include.

https://developer.servicenow.com/dev.do#!/reference/api/quebec/client/c_GlideAjaxAPI