How to get the previous value of the field in Business rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2020 11:29 PM
We want to update the value of the current field depends on the value of the previous field .
(function executeRule(current, previous /*null when async*/) {
var v = new GlideRecord('u_meeting_booking_details');
var prev1= previous.getvalue("u_string_1"); // unable to get the value using this syntax
gs.addInfoMessage(prev1);
var prev2= previous.getvalue("u_room_status"); // unable to get the value using this syntax
gs.addInfoMessage(prev2);
v.query();
while(v.next())
{
if(current.u_add_room == "volga"){
if(prev1 == "yes")
{
current.setValue("u_string_1","no");
current.setValue("u_room_status","yes");
}
else
{
current.setValue("u_string_1","yes");
current.setValue("u_room_status","no");
}
}
current.update();
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2020 12:16 AM
Hello Dinesh,
The previous object will not be available if you have selected async. Kindly check.
Mark the comment as a correct answer and helpful if it helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2020 04:46 AM
Hello Dinesh,
When you say previous, you meant the previous value on the record before updation or anything else? Your requirement is not fully clear. Would be great if you can elaborate your requirement of what you want to achieve with screenshots and it would be easier to assist you.
If you are on skype or webex, let us know and we can connect and look into it.