Workspace UI action is not working in SOW but working in AWS

Kiruthika J
Tera Contributor

Hi,
An UI action present in interaction form of SOW(service operation workspace) and AWS(agent work space).
It should open the catalog item in new workspace tab and copy the short description and description of interaction and paste it in short_description and description variable of catalog item. Please find the below screen short,
both SOW and AWS catalog item is getting opened in new workspace tab. but copy paste of field value to variable is not working in SOW alone.

KiruthikaJ_0-1747740801840.png

 

8 REPLIES 8

I didn't write any onload client script in catalog item, but without onload client script it's working fine in agent workspace but not SOW.

@Kiruthika J 

then write onload catalog client script and check in the browser URL if it's sow, then perform string manipulation and get the values from URL and set in variable

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

how to do that i'm stuck.

function onLoad() {
    //Type appropriate comment here, and begin script
    var output = getParameterValue('sysparm_short_description', 'sow');
    g_form.addInfoMessage("hi" + output);
    var output1 = getParameterValue('sysparm-short-description', 'agent');
    g_form.addInfoMessage("hiagent" + output1);


    function getParameterValue(parm, flag) {
        parm = parm.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regexS = "";
        if (flag === 'native') {
            regexS = "[\\?&]" + parm + "=([^&#]*)";
        } else if (flag === 'agent') {
            regexS = "[\\?\/]" + parm + "\/([^\/#]*)";
        } else if (flag === 'sow') {
            regexS = "%2F" + parm + "%2F([^%#]*)";
        }
        var regex = new RegExp(regexS);
        var results = regex.exec(top.location);
        if (results == null) {
            return "";
        } else {

            return unescape(results[1]);
        }
    }

}

@Kiruthika J 

share the sample SOW url as well here so that I can help

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