Agent Workspace Issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 02:28 PM - edited 02-19-2025 02:44 PM
Hello,
I'm trying to create a UI action that export an HR case record in both the case form in the native UI and Agent Workspace. The UI action works correctly in the native UI but does not function properly in Agent Workspace.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 02:59 AM - edited 02-17-2025 03:02 AM
Hi @Michael94
I just tried your code in my PDI by doing some minor changes. PFB the snaps/code. It's working as expected.
Please try and let me know how it goes.
UI action script:
function getPDF() {
var gaViewName = new GlideAjax('global.ValidateService');
gaViewName.addParam('sysparm_name', 'getViewName');
gaViewName.getXML(getView);
}
function getView(response) {
var instanceURL = "https://" + location.hostname + "/";
var sysparm_view = response.responseXML.documentElement.getAttribute("answer");
var sysparm_sys_id = g_form.getUniqueValue().toString();
var url = instanceURL + 'incident.do?PDF&sys_id=' + sysparm_sys_id + '&sysparm_view=' + sysparm_view;
top.window.open(url, '_blank');
}
Workspace script:
function onClick(g_form) {
var gaViewName = new GlideAjax('global.ValidateService');
gaViewName.addParam('sysparm_name', 'getViewName');
gaViewName.getXML(getView);
}
function getView(response) {
var instanceURL = "https://" + location.hostname + "/";
var sysparm_view = response.responseXML.documentElement.getAttribute("answer");
var sysparm_sys_id = g_form.getUniqueValue().toString();
var url = instanceURL + 'incident.do?PDF&sys_id=' + sysparm_sys_id + '&sysparm_view=' + sysparm_view;
top.window.open(url, '_blank');
}
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 12:03 AM - edited 02-19-2025 12:36 PM
I'm not sure if I get the correct response from ajax, however it's working fine in native ui action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 12:25 AM
Did you check my script and compare with your script? Below is working for me in the workspace.
var instanceURL = "https://" + location.hostname + "/";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 12:42 AM - edited 02-19-2025 12:35 PM
The missing part is getting the hr service value from the case form. I need it to get the correct view for the hr service and export it as pdf.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 12:46 AM - edited 02-18-2025 02:14 AM
Yep. That's intentional. Since I don't have HR module enabled, i did that testing with the incident table.
So you can just add the required lines as per your need.
And if possible could you please share your script from the script include.
Since you said, it's returning [object object].