workspace modal window
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2024 10:12 PM - edited ‎11-05-2024 08:33 PM
On selection of CI on incident form within the workspace, a modal(UI Builder modal component) window should be opened. anybody has worked on such requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2024 12:02 AM
@pratapdalai To open a modal window on selecting a Configuration Item (CI) in the incident form within ServiceNow’s workspace, you can use a Client Script or UI Action with an onChange event or an event handler in the workspace to trigger the modal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2024 09:58 AM
Can you please explain "UI Action with an onChange event " ,Could you please tell me what event to be used here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2024 05:47 PM - edited ‎11-05-2024 05:49 PM
@pratapdalai Use an onChange Client Script on the cmdb_ci Field,
in ServiceNow Workspace, you can use an onChange Client Script to detect when the CI field is updated.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Ensure the script only runs in Workspace
if (typeof g_form.isServiceWorkspace !== 'undefined' && g_form.isServiceWorkspace()) {
// Use a Workspace modal API to open the modal window
openCIModal(newValue); // have to define in workspace
}
}
Define the openCIModal Function for Workspace
Create the openCIModal function to handle the modal in Workspace:
function openCIModal(ciSysId) {
const modalOptions = {
title: 'CI Details',
size: 'lg', // Options: 'sm', 'md', 'lg', 'xl'
sysId: ciSysId,
table: 'cmdb_ci', // Table to load the CI record details
recordView: 'workspace-modal' // Ensure you have a view configured for the modal if needed
};
// Workspace uses the action modal, this function opens a record in a modal window
const modalAPI = window.top.GlideModalHandler.getModalWindowInstance('snRecordPreview', modalOptions);
modalAPI.open();
}
Just one note: ServiceNow Workspace's GlideModalHandler API, which is a Workspace-specific API for handling modals. And provided solution also depends on what version of workspace you are.
Hope this will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2024 05:07 PM
Tried your code above and in SOW it shows "normal flow" as the alert