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.

Get Previous State

madanm7786
Mega Guru

Hi All,

I need to use previous state value in one of my onLoad client script.

So i have written below BR to get the previous state.

Display Business Rule

g_scratchpad.oldvale = current.state;

And used this scratchpad in my onLoad client script.

var st = g_form.getValue('state');

var prest = g_scratchpad.oldvalue;

  g_form.addInfoMessage("Current state is "+st);

  g_form.addInfoMessage("Previous state is "+prest);

But i am not getting previous value. I am getting current value in both the statement.

Please help.

Thanks,

Maddy

10 REPLIES 10

madanm7786
Mega Guru

Hi All,



My requirement is,


when state is in "Pending" i need to clear all options in State field and i need to show only previous state.


So i trying onload client script and scratchpad. But with no luck.



When i use onchange, and when i save the form, it is loading all the options.




Thanks,