UI Action - Workspace client script not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 10:48 AM
Hi - I have this UI action - Apply Template to show up both in the native UI as well as in the Service Operations Workspace but in the workspace, the UI action doesn't work. I am missing something in this line of code. Can you please help me with it?
When I click on the UI action (Apply Template) it bring the list of templates, but when I select the template, nothing happens. This works in the native UI but not in the Workspace
This is the script in the Workspace client script
function onClick(g_form) {
var getTable = g_form.getTableName();
var getRecord = g_form.isNewRecord().toString();
function applyTemplate(sTemplateObject) {
oTemplate = JSON.parse(sTemplateObject);
applyTemplate(oTemplate.sid);
g_form.setValue("u_template", oTemplate.sid);
g_form.addInfoMessage("Template" + oTemplate.name + " has been applied.");
g_form.submit('apply_template');
}
function openPopup() {
var url = "/applicable_templates.do?sysparm_recordtable=" + getTable + "&sysparm_recordexists=" + getRecord;
getMessage('Please select a Template', function(msg) {
g_modal.showFrame({
title: msg,
url: url,
size: 'lg',
autoCloseOn: 'URL_CHANGED',
callback: function(ret, data) {
if (ret)
applyTemplate(data);
}
});
});
}
openPopup();
}
0 REPLIES 0