Restrict Team Virtual Agent Integration usage for Desktop Users.

Shikha8
Tera Contributor

Hello All,

We have recently done Teams Virtual Agent Integrations. We want this should only be visible for Desktop Users not for Mobile users. Is there a way we can restrict it. Thanks.

1 REPLY 1

cloudops
Tera Expert

Yes, you can restrict the Teams Virtual Agent for Desktop users only by using conditional scripting. Here's a high-level overview of how you can achieve this:

1. Identify the User Agent: ServiceNow can identify the user's device type through the User Agent. You can use the navigator.userAgent property in JavaScript to get the User Agent string.

2. Create a Script Include: Create a Script Include that checks the User Agent string and determines whether the user is on a mobile device or a desktop.

Sample Code:

var CheckDevice = Class.create();
CheckDevice.prototype = {
initialize: function() {
},

isMobile: function() {
var userAgent = this.getUserAgent();
if (userAgent.match(/Mobile/i)
|| userAgent.match(/iPhone/i)
|| userAgent.match(/iPod/i)
|| userAgent.match(/IEMobile/i)
|| userAgent.match(/Windows Phone/i)
|| userAgent.match(/Android/i)
|| userAgent.match(/BlackBerry/i)
|| userAgent.match(/webOS/i)) {
return true;
}
return false;
},

getUserAgent: function() {
return navigator.userAgent;
},

type: 'CheckDevice'
};


3. Use the Script Include in a UI Script: Create a UI Script that calls the Script Include and hides the Teams Virtual Agent for mobile users.

Sample Code:

var deviceCheck = new CheckDevice();
if (deviceCheck.isMobile()) {
// Hide Teams Virtual Agent
}


4. Apply the UI Script: Apply the UI Script to the relevant pages where the Teams Virtual Agent is displayed.

 

For asking ServiceNow-related questions try this :
For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.
Link - nowgpt.ai