Integrate Microsoft 365 Copilot for Service in ServiceNow
You can embed Microsoft 365 Copilot for Service directly into the ServiceNow desktop with contextual awareness of the underlying platform. This integration helps Copilot for Service provide better responses, and helps to further streamline the workflow for your agents.
Prerequisites
Before you begin, you must have the following environments and console:
- A Copilot for Service instance connected to a ServiceNow environment.
- A ServiceNow production environment or trial environment.
Additionally, for your agents to be able to use Copilot for Service in ServiceNow, you must assign the agent role to them. For information on how to assign this role to agents, see Assign a security role to a user.
Step 1: Copy the Copilot for Service widget URL
- Sign in to your Copilot for Service instance.
- On the sitemap, select Channels, and then select ServiceNow.
- Copy the URL starting after <iframe src=. For example, https://copilotforservice-test.azureedge.net/widget/index.html?dynamicsUrl=https://XXXXXX.crm10.dynamics.com
- Save the URL locally, where you can copy and paste it in a later step.
Step 2: Install the Knowledge API plugin
- In your ServiceNow environment, select All, search for plugins, and then select System Definition > Plugins.
- Search for Knowledge API. The system should return knowledge api plugin (App id: sn_km_api).
- Select the Knowledge API card.
- Select Install, and then select the latest version.
- Select Install now, and then wait for the Knowledge API installation to complete.
Step 3: Install the Openframe plugin
- In your ServiceNow environment, select All, search for plugins, and then select System Definition > Plugins.
- Search for Openframe. The system should return openframe plugin (Plugin id: com.sn_openframe).
- Select Install to start the plugin installation.
- Select Install, and then wait for the installation to complete.
Step 4: Install the Customer Service plugin
- In your ServiceNow environment, select All, search for plugins, and then select System Definition > Plugins.
- Search for com.sn_customerservice. The system should return Customer Service (Plugin id: com.sn_customerservice).
- Select Install to start the plugin installation.
- Select Install, and then wait for the installation to complete.
Step 5: Add the UI script for workspace navigator
- In your ServiceNow environment, ensure that you're in the Global workspace: Select the globe icon in the upper-right corner, and then verify that Application scope is set to Global.
- Select All, and then search for UI Scripts, and then select System UI > UI Scripts.
- Select New, and then fill in the form as follows:
- API Name: Copilot open frame workspace script
- UI type: Mobile/Service Portal
- Script: Copy the contents of the following script:
(function () {
try {
var logMoniker = "Copilot Navigator UI script: ";
if (!globalThis.copilotNavigationWorkspaceListenerAdded) {
console.log(logMoniker + "loading workspace navigator....");
var payload = {
url: globalThis.window.location.href,
source: "workspaceUIScript",
sourceId: "b54abfa8-3d78-4aa0-ae3f-1e2ffbc56850",
configType: "singleFrame"
};
var context = {
payload: JSON.stringify(payload),
method: "openframe_communication"
};
globalThis.CustomEvent.fireAll("openframe_request", context);
globalThis.window.navigation.addEventListener("navigate", (event) => {
console.log(
logMoniker +
"Workspace PAGE NAVIGATED: " +
"\n Old Url: " +
globalThis.window.location.href +
"\n New url: " +
event.destination.url
);
var payload = {
url: event.destination.url,
source: "workspaceUIScript",
sourceId: "b54abfa8-3d78-4aa0-ae3f-1e2ffbc56850",
configType: "singleFrame"
};
var context = {
payload: JSON.stringify(payload),
method: "openframe_communication"
};
globalThis.CustomEvent.fireAll("openframe_request", context);
});
globalThis.copilotNavigationWorkspaceListenerAdded = true;
} else {
console.log(logMoniker + "Workspace navigator already loaded....");
}
} catch (error) {
console.error(logMoniker + "Workspace Navigator error");
console.error(error);
}
function initialiseScript() {
// do nothing
}
return initialiseScript;
})();
Step 6: Add the UI script for classic UI navigator
- In your ServiceNow environment, ensure that you're in the Global workspace: Select the globe icon in the upper-right corner, and then verify that Application scope is set to Global.
- Select All, and then search for UI Scripts, and then select System UI > UI Scripts.
- Select New, and then fill in the form as follows:
- API Name: Copilot open frame desktop script
- UI Type: Desktop
- Select the Global checkbox.
- Script: Copy the contents of the following script:
(function () {
try {
var logMoniker = "Copilot Navigator UI script: ";
if (
!window.parent.navigationListenerAdded &&
!window.copilotNavigationClassicListenerAdded
) {
console.log(logMoniker + "loading desktop navigator....");
var payload = {
url: window.location.href,
source: "classicUIScript",
sourceId: "b54abfa8-3d78-4aa0-ae3f-1e2ffbc56850",
configType: "singleFrame"
};
var context = {
payload: JSON.stringify(payload),
method: "openframe_communication"
};
CustomEvent.fireAll("openframe_request", context);
window.navigation.addEventListener("navigate", (event) => {
console.log(
logMoniker +
"desktop PAGE NAVIGATED: " +
"\n Old Url: " +
window.location.href +
"\n New url: " +
event.destination.url
);
var payload = {
url: event.destination.url,
source: "classicUIScript",
sourceId: "b54abfa8-3d78-4aa0-ae3f-1e2ffbc56850",
configType: "singleFrame"
};
var context = {
payload: JSON.stringify(payload),
method: "openframe_communication"
};
CustomEvent.fireAll("openframe_request", context);
});
window.copilotNavigationClassicListenerAdded = true;
} else {
console.log(logMoniker + "Skipping desktop navigator load....");
}
} catch (error) {
console.log(logMoniker + "Classic UI navigator error");
console.log(error);
}
})();
Step 7: Add client scripts for linking tables
- In your ServiceNow environment, ensure that you're in the Global workspace: Select the globe icon in the upper-right corner, and then verify that Application scope is set to Global.
- Select All, and then search for Client Scripts, and then select System Definition > Client Scripts.
- Select New, and then fill in the form as follows:
- Name: Copilot open frame incident table script
- Table Incident [incident]
- UI Type: Desktop
- Type onLoad
- Script: Copy the contents of the following script:
function onLoad() {
try {
var tableName = g_form.getTableName();
var id = g_form.getUniqueValue();
var payload = {
recordId: id,
objectType: tableName,
source: "classicClientScript",
sourceId: "b54abfa8-3d78-4aa0-ae3f-1e2ffbc56850",
configType: "singleFrame"
};
var context = {
payload: JSON.stringify(payload),
method: "openframe_communication"
};
CustomEvent.fireAll("openframe_request", context);
} catch (error) {
console.log(
"Copilot Navigator UI script: CopilotClassicClientScriptCase navigator error"
);
console.log(error);
}
}
- Select New again, and then fill in the form as follows:
- Name: Copilot open frame email table script
- Table: Email [sys_email]
- UI type: Desktop
- Type onLoad
- Script: Copy the contents of the following script.
function onLoad() {
try {
var tableName = g_form.getTableName();
var id = g_form.getUniqueValue();
var payload = {
recordId: id,
objectType: tableName,
source: "classicClientScript",
sourceId: "b54abfa8-3d78-4aa0-ae3f-1e2ffbc56850",
configType: "singleFrame"
};
var context = {
payload: JSON.stringify(payload),
method: "openframe_communication"
};
CustomEvent.fireAll("openframe_request", context);
} catch (error) {
console.log(
"Copilot Navigator UI script: CopilotClassicClientScriptCase navigator error"
);
console.log(error);
}
}
- Select New again, and then fill in the form as follows:
- Name: Copilot open frame case table script
- Table: Case [sn_customerservice_case]
- UI type: Desktop
- Type onLoad
- Script: Copy the contents of the following script.
function onLoad() {
try {
var tableName = g_form.getTableName();
var id = g_form.getUniqueValue();
var payload = {
recordId: id,
objectType: tableName,
source: "classicClientScript",
sourceId: "b54abfa8-3d78-4aa0-ae3f-1e2ffbc56850",
configType: "singleFrame"
};
var context = {
payload: JSON.stringify(payload),
method: "openframe_communication"
};
CustomEvent.fireAll("openframe_request", context);
} catch (error) {
console.log(
"Copilot Navigator UI script: CopilotClassicClientScriptCase navigator error"
);
console.log(error);
}
}
- Select New again, and then fill in the form as follows:
- Name: Copilot open frame email table script
- Table: Email [sys_email]
- UI type: Desktop
- Type onLoad
- Script: Copy the contents of the following script:
function onLoad() {
try {
var tableName = g_form.getTableName();
var id = g_form.getUniqueValue();
var payload = {
recordId: id,
objectType: tableName,
source: "classicClientScript",
sourceId: "b54abfa8-3d78-4aa0-ae3f-1e2ffbc56850",
configType: "singleFrame"
};
var context = {
payload: JSON.stringify(payload),
method: "openframe_communication"
};
CustomEvent.fireAll("openframe_request", context);
} catch (error) {
console.log(
"Copilot Navigator UI script: CopilotClassicClientScriptCase navigator error"
);
console.log(error);
}
}
Step 8: Configure widget in ServiceNow
- In your ServiceNow environment, select All, search for OpenFrame, and then select Openframe > Configurations.
- In the upper-right corner, select New.
- Type Microsoft Copilot for the name and title.
- Type 450 for the width and 600 for the height.
- Select the User Groups you want to enable Copilot for Service for.
- Select the lock icon next to the URL field to unlock it, and then paste the Copilot for Service widget URL you saved earlier from the Copilot for Service admin page.
- Select Submit.
- Refresh the page. The Copilot for Service widget should be available on the top navigation bar for the icon you selected.
- Before you open Copilot for Service, ensure that you allowed popups from your ServiceNow page.