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 01:57 AM
If the state value is not changing between query from DB and displaying that in form then how you expect two values here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 01:59 AM
I believe previous object is only available for before and after business rule and not to the display and query BR
Your display business rule runs first...even before form is rendered...and it pulls the value from the server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:09 AM
Hi Deepak,
I changed the state from New to Work In Progress.
And in both the statement i am getting Work In Progress.
I also tried with before and after BR. In this case, i am getting "Previous state is Undefined"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:12 AM
As Deepak correctly pointed that Previous object is not present in display BR.
Although from your client script you can directly get the old value so you dont really need to set it in display br.