popup window is not working on Retire UI action on knowledge table

Ramesh Poola
Tera Guru

I am trying to create a copy of OOB retire UI action which helps to provide replacement article if we want to provide any knowledge article at a time of retiring the KA. When I click on Retire UI action which I created, popup is coming and I am able to provide replacement article, but after providing replacement article when I click on retire nothing is happening.

 

RameshPoola_1-1698660487312.png
What is happening is.. once we click on Retire UI action it opens the UI page popup (I have attached the image for your reference) asking if we want to provide replacement article we can provide else we can select no and we can retire the article, if we select yes then we have to provide the replacement article then it will store both replacement article sys id and currently retiring KA sys id and then using gs.session in AJax this page passes sys ids to UI action.
In the UI action it is checking typeof window == undefined then only it process next steps.
But the typeof window is object here. 
Please help me to understand why typof window is object here instead of undefined


if(typeof window == 'undefined') {
    var replacementArticleId = gs.getSession().getClientData('replacementArticleId_' + current.getUniqueValue()) + '';
    gs.nil(replacementArticleId) ? retireKnowledge() : retireKnowledgeWithReplacement(replacementArticleId);
}
 
 
This is the UI action I am trying to copy 

https://<INSTANCE_NAME>.service-now.com/now/nav/ui/classic/params/target/sys_ui_action.do%3Fsys_id%3Df21d1087f034c510f877bdce65680991%26sysparm_record_target%3Dsys_ui_action%26sysparm_record_row%3D3%26sysparm_record_rows%3D3%26sysparm_record_list%3DnameCONTAINSretire%255EtableCONTAINSknowledge%255EORDERBYorder



 

 

 

1 ACCEPTED SOLUTION

Ramesh Poola
Tera Guru

Hi All,

 

Thanks Anukur for your reply.


I just want to post the solution here also so that it might be helpful for any others, this issue was finally resolved by Unchecking the Isolate Script check box in the UI action.

Note: Isolate Script check box will not be available by default in the form view.

 

You can find more information about this Isolate Script check box in below two links :

https://www.servicenow.com/community/developer-blog/isolate-script-in-london/ba-p/2275821

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743155

 

 

 

Best Regards,
Ramesh

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Ramesh Poola 

what debugging have you done so far and what's your findings?

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

Hi Ankur,
Thanks for you response,

I am getting this error in browser console when I click on retire button 

 Uncaught TypeError: Cannot read properties of null (reading 'destroy')
at String.destoryDialog 
at klass._responseReceived (js_includes_doctype.jsx?v=07-23-2023_0036&lp=Fri_Oct_13_03_07_44_PDT_2023&c=30_703:17132:13)
at klass._processReqChange (js_includes_doctype.jsx?v=07-23-2023_0036&lp=Fri_Oct_13_03_07_44_PDT_2023&c=30_703:16961:15)


This is the AJAX call code in UI page client script 

var ajaxHelper = new GlideAjax('KBAjax');
ajaxHelper.addParam('sysparm_type', 'storeReplacementArticleId');
ajaxHelper.addParam('sysparm_replacement_article_id', isReplacementRequired ? gel('replacement-article').value : null);
ajaxHelper.addParam('sysparm_base_article_id', '${JS:sysparm_base_article_id}');
ajaxHelper.getXMLAnswer(destoryDialog.bind('${JS:sysparm_parent_form}'));
   
return true;
}

I am trying to understand why that error is coming in browser console. Kindly please help me to understand the same.

Ramesh Poola
Tera Guru

Hi All,

 

Thanks Anukur for your reply.


I just want to post the solution here also so that it might be helpful for any others, this issue was finally resolved by Unchecking the Isolate Script check box in the UI action.

Note: Isolate Script check box will not be available by default in the form view.

 

You can find more information about this Isolate Script check box in below two links :

https://www.servicenow.com/community/developer-blog/isolate-script-in-london/ba-p/2275821

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743155

 

 

 

Best Regards,
Ramesh