Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Widget on service portal

JoseSantosA
Tera Contributor

I am working on service platform. I have cloned the out of the box widget call "KB Most viewed", when I drag and drop original widget into my page it works fine but when I drag and drop the one that I cloned from the original is causing an error, is not being displayed. 

I have this piece of code in the server script but it seems I have some access issues because i dont see the log from line #11.

 

JoseSantosA_0-1762455342169.png


I have made the cloned widged as public, the page is public as well, idk what else i need to make public so this can work

 

2 REPLIES 2

Sarthak Kashyap
Kilo Sage

Hi @JoseSantosA ,

 

Are you getting the log at line number 7 ? 

Try below code 

 

gs.info("Widget Clone start Test ");
    try {
        var gr = new GlideRecord("kb_knowledge");
        gr.addQuery("number", "KB0000492");
        gr.query();
        gs.info("Record count: " + gr.getRowCount());
        while (gr.next()) {
            gs.info("Found record =  " + gr.number);
        }
        gs.info("Widget Clone End Test");
    } catch (e) {
        gs.info("Error in KB widget clone: " + e.message);
    }

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

 

SVimes
Kilo Sage

First, you shouldn't try logging console from the server script. Console logging is something that should be done in the client controller. You can populate the data object in the server script which the client script can reference like this:

 

SVimes_0-1762458565969.png

 

Second, I cloned the same widget and added it without modifications to a blank page which works just fine by itself which tells me something else is conflicting. Are you able to share the full html, server, and client code for the new widget?

Sable Vimes - CSA