Agent Workspace Issue

Michael94
Tera Contributor

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. 

 

 

20 REPLIES 20

@Michael94 

did you add console.log() in workspace client script and see if you got ajax response?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

The ajax response in workspace client script is returning [object, Object]. But the UI action works fine in native. 

@Michael94 

are you able to form the URL correctly in workspace client script?

can you try this?

function onClick(g_form) {
    exportPDF();

    function exportPDF() {
        var hrService = g_form.getValue('hr_service');
        var gaViewName = new GlideAjax('sn_hr.validateService');
        gaViewName.addParam('sysparm_name', 'getViewName');
        gaViewName.addParam('sysparm_service', hrService);
        gaViewName.getXMLAnswer(function(answer) {
            var sysparm_view = answer;
            var sysparm_sys_id = g_form.getUniqueValue().toString();
            var url = '/sn_hr_case.do?PDF&sys_id=' + sysparm_sys_id + '&sysparm_view=' + sysparm_view;
            open(url);
        });
    }
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

No, I can't form the URL in workspace client scrip.

@Michael94 

please check the script I shared.

did you try adding console.log() and see what was returned from script include function

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader