- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2021 04:41 AM
Can someone explain me what current and previous in servicenow business rule with examples.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2021 05:19 AM
Hi,
As you know business rule execute when CRUD operations happen on any record.
When before and After Business rule is running it gets two copy of the record which is changed.
Previous is a copy of same GlideRecord object storing old values (Original copy)
Current is copy of GlideRecord object storing New values (Updated copy)
For Example:
When you opened any incident it was having state as new and Assigned to empty (This will be your Previous copy). Now you changed state and assigned_to fields and saved form (This is updated i.e current copy).
If you try to log below lines for above example :
gs.info(previous.state); // it will print new (i.e 1)
gs.info(previous.assigned_to); // it will print nothing (assihnedto was empty)
gs.info(current.state); // it will print In Progress (i.e 2)
gs.info(current.assigned_to); // it will print sys_id of assigned_to user
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2021 05:14 AM
current and previous
Business Rules often use the current and previous objects in their script logic.
The current object is automatically instantiated from the GlideRecord class. The current object's properties are all the fields for a record and all the GlideRecord methods. The property values are the values as they exist in the runtime environment.
The previous object is also automatically instantiated from the GlideRecord class. The previous object's properties are also all fields from a record and the GlideRecord methods. The property values are the values for the record fields when they were loaded from the database and before any changes were made. The previous object is not available for use in async Business Rules.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2021 05:19 AM
Hi,
As you know business rule execute when CRUD operations happen on any record.
When before and After Business rule is running it gets two copy of the record which is changed.
Previous is a copy of same GlideRecord object storing old values (Original copy)
Current is copy of GlideRecord object storing New values (Updated copy)
For Example:
When you opened any incident it was having state as new and Assigned to empty (This will be your Previous copy). Now you changed state and assigned_to fields and saved form (This is updated i.e current copy).
If you try to log below lines for above example :
gs.info(previous.state); // it will print new (i.e 1)
gs.info(previous.assigned_to); // it will print nothing (assihnedto was empty)
gs.info(current.state); // it will print In Progress (i.e 2)
gs.info(current.assigned_to); // it will print sys_id of assigned_to user
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2021 10:06 AM
Thanks Anil,
Now I've a clear picture š

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-20-2021 10:11 PM
Thanks
Anil Lande