Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Ui action to open the Kb artical

SidharthReddy
Tera Contributor

Hi All,

 I am creating one Ui Action . When the user click on the  button it should redirect to the  some Kb article and i am fetching the KB  latest published  kb article but when i clicked on the button its not working .Please find the script below and let me know if any changes has to be done. I have checked the client check box as well and on click also i have mentioned

 

Script : 

function OnClick() {
    var attchement = "number=KB0056358^kb_knowledge_base=6ad1badfdbe80054b19fe32748961958^kb_category=381d7e91dbac0054b19fe3474896199e^workflow_state=published";
    var grKbN = new GlideRecord("kb_knowledge");
    grKbN .addEncodedQuery(attchement ); // Corrected method to add query
    grKbN .query();
    while (grKbN .next()) {
        var sysID = grKbN.sys_id;

    }

    var url = "/now/nav/ui/classic/params/target/kb_knowledge.do%3Fsys_id%3Dc4d99c928726ca9407f1cae50cbb35d5";
   
   

    window.open(url, '_blank');


}
0 REPLIES 0