Using UI page in workspace client script - for configurable workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 02:15 PM
I am trying to call a UI page from workspace client script of a UI action
here is the OOTB script of UI action:
==============================
function openFollowOnPopUp(){
var dialogClass;
try {
dialogClass = GlideModal;
} catch(e) {
dialogClass = GlideDialogWindow;
}
var dialog = new dialogClass("service_management_task_closed_incomplete");
dialog.setWidth("550");
dialog.setTitle("Close Incomplete");
dialog.setPreference("sys_id", g_form.getUniqueValue());
dialog.setPreference("work_notes", g_form.getValue("work_notes"));
dialog.setPreference("state_flow_id", "41dfa2e0d7630100fceaa6859e61035d");
dialog.render(); //Open the dialog
}==============================
I created this and it shows the UI page but not passing variable from current record to UI page
Workspace client script: shows the modal, take the value but not doing anything.
==========================================
function onClick(g_form) {
var ui_page_id = '03d9bd5fdf81300068c383f36bf26312';
g_modal.showFrame({
url: '/ui_page.do?sys_id=' + ui_page_id,
title: 'Close Incomplete',
})
.then(function(modalResult) {
g_form.setValue('sys_id', g_form.getUniqueValue());
g_form.setValue('work_notes', g_form.getValue("work_notes"));
g_form.setValue('state_flow_id', '41dfa2e0d7630100fceaa6859e61035d');
g_form.save();
},
function(error) {
location.reload(); //to refresh the page if "cancel" or "X" is clicked
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 06:32 PM
HGi @MS25
Workspaces are based on a complete new technology and it's very difficult to reuse UIO Pages from the old world.
Instead, rebuild your script nailed to the new options. See the following article for an inspiration: https://www.servicenow.com/community/next-experience-articles/how-to-use-ui-actions-in-workspaces/ta...
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 05:48 AM
I tried this using the link you provided. Question is how do we pass current records field data to UI page in this script. Just like UI action script (first script in question) is passing?
====================================================
function onClick(g_form) {
var ui_page_id = '03d9bd5fdf81300068c383f36bf26312';
g_modal.showFrame({
url: '/ui_page.do?sys_id=' + ui_page_id,
title: 'Close Incomplete',
})
.then(function(modalResult) {
g_form.setValue('sys_id', g_form.getUniqueValue());
g_form.setValue('work_notes', g_form.getValue("work_notes"));
g_form.setValue('state_flow_id', '41dfa2e0d7630100fceaa6859e61035d');
g_form.save();
},
function(error) {
location.reload(); //to refresh the page if "cancel" or "X" is clicked
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 04:07 AM
Was this fixed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2024 06:31 AM
Same issue as well here. Want to pass some values to a UI Page then when you interact with a UI page you get a result that gets passed to the form.