Chat icon in portal

hd_123
Tera Contributor

I want to hide the virtual agent chat icon for the c3i users that is where the users are with special instructions containing C3i full support. How can it be achieved.

4 REPLIES 4

SwarnadeepNandy
Mega Sage

Hello @hd_123,

To hide the virtual agent chat icon for the c3i users, you need to customize the Service Portal widget for Virtual Agent (sn-va-sp-widget) and add some logic to check the user’s special instructions field. You can use the GlideSystem user object and its methods to get information about the current user, such as their user ID, company, department, location, etc. You can also use the GlideRecord object and its methods to query the user table and get the value of the special instructions field.

Here is a possible code snippet that you can use to hide the chat icon based on the user’s special instructions:

 

// Get the current user object
var user = gs.getUser();

// Get the user sys_id
var userID = user.getUserID();

// Create a GlideRecord object for the user table
var grUser = new GlideRecord('sys_user');

// Query the user table by sys_id
grUser.get(userID);

// Get the value of the special instructions field
var specialInstructions = grUser.getValue('special_instructions');

// Check if the special instructions contain C3i full support
if (specialInstructions.indexOf('C3i full support') > -1) {
  // Hide the chat icon
  data.hideChatIcon = true;
} else {
  // Show the chat icon
  data.hideChatIcon = false;
}

 

You can find more information about how to configure the Service Portal widget for Virtual Agent in this article

 

Hope this is helpful.

 

Kind Regards,

Swarnadeep Nandy

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Are you using Agent Chat configuration? Or are you using a legacy Service Portal widget (or cloned/custom widget)?

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

Service portal agent Chat Config

Raju320
Tera Contributor

Hello @hd_123 

 

Did you find the solution, If you found the solution, please share here..