Mark Roethof
Tera Patron
Tera Patron

Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Hi there,

 

When working with the Virtual Agent web client, there are several parameters that you can add to Service Portal Agent Chat Configuration and a (legacy) Service Portal widget. Parameters like loading a specific topic, disabling sound notifications, activating live agent only, etcetera. In a few short articles, I'll share a bit of background information on some of these parameters. This time: Loading only the active conversation in the Virtual Agent web client.

 

Load active only

By default when a new conversation is started, the previous message history (up to a month) will be loaded. It is possible to disable this behavior and start a new conversation without the previous message history. Personally I like this option a lot, having a clean chat history, no micture of recent HR and IT chats, etcetera. Downside though, when a new window is opened and using the Virtual Agent web client... the previous message history is gone, also your active conversation history! With the San Diego release ServiceNow introduced a new URL parameter which solves this: Load active only. This URL parameters skips the previous message history, and only keeps the active conversation history.

 

Note: If the skip_load_history and load_active_only parameters are both set to true, the existing skip_load_history parameter takes precedence.

 

Depending on how you implemented the Virtual Agent web client on your instance, you would need to add a parameter to the applicable Service Portal Agent Chat Configuration record, or add it to the URL parameters of the (legacy) Service Portal widget. Both methods do work slightly differently.

 

Service Portal Agent Chat Configuration

If you are using Service Portal Agent Chat Configuration, open the applicable Service Portal Agent Chat Configuration record. Within the Server Script you would need to add "load_active_only: true" to load only the active conversation history.

 

For example:

 

(function($sp) {

    return = {
        load_active_only: true
    };

})($sp);

 

 

(legacy) Service Portal widget

If you are using a (legacy) Service Portal widget, verify if it concerns an embedded widget (for example to the header or footer of the portal) or that it concerns a widget instance that has been added to a specific page.

 

Widget instance

When having a Widget instance in place, ctrl + right-click on the Virtual Agent icon, and select "Instance Options".

 

1.png

 

Within the modal, add to the "Virtual Agent Client URL Parameters" field:

 

sysparm_load_active_only=true

 

 

Embedded widget

A commonly seen method when working with the Virtual Agent web client, is embedding the Service Portal widget to the header or footer of the portal. Adding URL parameters is also possible in this case, I've explained such in a previous article (Adding instance options to directly embedded Service Portal Widgets).

 

For example, your code for embedding the Service Portal widget might look like this:

 

<widget id="sn-va-sp-widget"></widget>

 

 

To only load the active conversation history you would need to expand this to:

 

<widget id="sn-va-sp-widget" options='{"va_url_params":"&sysparm_load_active_only=true"}'></widget>

 

---

 

And that's it! A short explanation on how you can only load the active conversation history in the Virtual Agent web client, for both Service Portal Agent Chat Configuration and a Service Portal widget. If any questions, let me know!

 

C

If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.

 

Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in?
- Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Kind regards,


Mark Roethof

Independent ServiceNow Consultant

3x ServiceNow Developer MVP

3x ServiceNow Community MVP

---

LinkedIn

Comments
Ishaan Shoor
Mega Sage
Mega Sage

Thanks for sharing! 

Version history
Last update:
‎08-03-2024 05:11 AM
Updated by:
Contributors