Get Previous State
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 01:49 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:20 AM
Hi Anurag,
Please help me in getting previous value in client script.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:22 AM
there you go
http://wiki.servicenow.com/index.php?title=Client_Scripts#onChange.28.29_Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:31 AM
Hi Anurag,
I need to use this in onLoad sclient script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:36 AM
onLoad Client script used to hide/display fields which you don't want to show to some users.
I think you should use onChange Client script and use new and old there if any user chaining the value from form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:48 AM
onchange client script runs onload also.