Client scripts is NOT working custom workspace

HARI KISHAN GVS
Mega Sage

Hi Team,

I have one Onload and Onchange client scripts to update the related list filter conditions on a form.

Both these onload and onchange are working in native view but NOT in custome workspace.

 

Onload:

function onLoad() {
    //Type appropriate comment here, and begin script below
    setTimeout(function() {
        var list = GlideList2.get(g_form.getTableName() + '.REL:e6c6a9c21b035510d3876288b04bcb24');
        list.setFilterAndRefresh("active=true^u_serial_no_providedISNOTEMPTY^u_serial_no_providedISEMPTY");
    }, 700);
}
 
Onchange:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {

    if (isLoading || newValue === '') {
        return;
    }
    var serialNumProvide = g_form.getValue("u_serial_provided");
    var toUpperCaseValue = serialNumProvide.toUpperCase().trim();
    alert(toUpperCaseValue);

    //Set filter with closed case form past 6 months and open cases
    var list = GlideList2.get(g_form.getTableName() + '.REL:e6c6a9c21b035510d3876288b04bcb24');
   // var q = "closed_atONLast 6 months@javascript:gs.beginningOfLast6Months()@javascript:gs.endOfLast6Months()^ORstateIN1,10,18,13,6,3^u_serial_no_provided=" + toUpperCaseValue + "^ORDERBYDESCsys_created_on";
    var q  = "closed_atONLast 6 months@javascript:gs.beginningOfLast6Months()@javascript:gs.endOfLast6Months()^ORstateIN1,10,18,13,6,3^u_serial_no_providedLIKE" + toUpperCaseValue + "^ORDERBYDESCsys_created_on";
   
    list.setFilterAndRefresh(q);
}
 
Related List relationship script:
current.addEncodedQuery("u_serial_no_providedISNOTEMPTY");
 
 
in Workspace, Relationship Script is taking effect and not changing based on Onload and Onchange.
 
Please let me know how to fix the issue and please provide the script modifications if possible.
Thanks,
Hari Kishan.
4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@HARI KISHAN GVS 

Did you check the scripts are marked as global so that they run for all view?

seems GlideList2 and setFilterAndRefresh is not supported in workspace?

Did you check any browser console error when the script runs in workspace view?

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

Hi @Ankur Bawiskar ,

Yes, Scripts are marked as global and Isolate script is also Checked true on Both.

in Browser console also i am not seeing any issues.

GlideList2 and setFilterAndRefresh is not supported in workspace? -- Don't know the answer to this question.

Thanks,

Hari Kishan.

@HARI KISHAN GVS 

Seems it's not supported in workspace

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

@HARI KISHAN GVS 

Hope you are doing good.

Did my reply answer your question?

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