@AbhishekK512254 

it worked for me in both native + workspace, see below I got info message present in server side both the times.

Script:

function showFunction() {
    alert('inside normal client script');
    var url = '/' + 'incident' + '.do?PDF&sys_id=' + g_form.getUniqueValue() + '&sysparm_view=workspace';
    alert(url);
    top.window.open(url, "_blank");

    gsftSubmit(null, g_form.getFormElement(), "export_pdf");
}

if (typeof window == 'undefined')
    runBusRuleCode();

function runBusRuleCode() {
    gs.addInfoMessage('server side');
}

Workspace client script:

function onClick(g_form) {
    var ans = confirm("Do you want to move ahead?");
    if (ans == true) {
        alert('inside workspace client script');
        var url = '/' + 'incident' + '.do?PDF&sys_id=' + g_form.getUniqueValue() + '&sysparm_view=workspace';
        alert(url);
        open(url, "_blank");
        g_form.submit(g_form.getActionName()); // matching the UI action name
    }
}

AnkurBawiskar_0-1746441896357.png

 

AnkurBawiskar_1-1746441904725.png

 

Output:

workspace custom UI action client and server.gif

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

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