- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 08:18 AM
Hi,
Could you please help me i am strggling to disable history and show only 24 hours of history to users on the virtual agent chat.
If i use skip_load_history: true in server script of agent chat record. it is disabling all history also when user is in middle of the session the and goes to some knowledge article page then the bot is restarting from the scratch.
Any response from anyone would reduce my struggle.
Thanks,
Shaikha
Solved! Go to Solution.
- Labels:
-
Virtual Agent
- 1,475 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 08:41 AM
Hi there,
Curious if it would work, I tried something...
A before query Business Rule on sys_cs_message. Only for messages of today, for example:
(function executeRule(current, previous /*null when async*/) {
var qc = current.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
})(current, previous);
Query for last 24 hours could be something like:
sys_created_onRELATIVEGT@hour@ago@24
This would only show you the history of today.
You might want to add a condition to the Business Rule. Like not running for admin, virtual_agent_admin. For example:
!gs.hasRole('virtual_agent_admin')
Also test! I haven't looked if this gives other issues.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 08:41 AM
Hi there,
Curious if it would work, I tried something...
A before query Business Rule on sys_cs_message. Only for messages of today, for example:
(function executeRule(current, previous /*null when async*/) {
var qc = current.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
})(current, previous);
Query for last 24 hours could be something like:
sys_created_onRELATIVEGT@hour@ago@24
This would only show you the history of today.
You might want to add a condition to the Business Rule. Like not running for admin, virtual_agent_admin. For example:
!gs.hasRole('virtual_agent_admin')
Also test! I haven't looked if this gives other issues.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2020 02:55 AM
Thank you so much
I appreciate your quick response and efforts.