call a table using form Button

TR5
Tera Contributor

Hello,
I have a requirement to restrict ‘publish’ UI Action on kb_knowledge(knowledge Article) form if the kb_knowledge_base record of the attached knowledge base has no checklist attached.
so if I click on publish a pop-up window should be shown up where I can attach a checklist and when the checklist is created only then state of knowledge article be changed to review/ published.
I have made a copy of KnowledgeSNC Script include and added the check to verify checklist is attached or not.

hasAttachedChecklist: function(knowledgeGR) {
    // Query the related checklist records for the knowledge article
    var gr = new GlideRecord("kb_knowledge");
    gr.addQuery("kb_knowledge_base", knowledgeGR.sys_id);
    gr.query();
    if(gr.next()){
        var checklistExist = gr.checklist.getValue();
        if(checklistExist != null)
        return true;
    }else {
return false;
        //open reference of checklist
//  on UI Action form when false is returned checklist table should be a popup where I can select an existing AQI or a new one then that KA move to review/published state
        }
   
    },


but on form UI Action I don't find any workaround to solve this problem.
some sites were suggested using GlideModal API but I didn't find a way to call a table using this API.
Has anyone worked with this scenario?
what approach i should choose I don't have any clarity regarding this

0 REPLIES 0