The CreatorCon Call for Content is officially open! Get started here.

Call JS include in service portal

ark6
Mega Guru

Hi,

I want to call JS files from service portal.

I have tried to use the JS includes tab in the themes, however it doesnot seem to work.

Do I need to call it by making a UI script?

Regards,

Ark

5 REPLIES 5

lorisd_avanzo
ServiceNow Employee
ServiceNow Employee

Hi Ark,



The UI Script solution seems to be the correct one. The below community post may help:


Service Portal UI Script or Reusable functions in Client Scripts



Regards,


Loris


Sorry Loris, unfortunately its not working


Hi Arka,
    Did you get your dependency to work for you?



Best,


  Phil E.


philengles
Giga Expert

Hi Arka,


    Yes this requirement is achievable, this hasn't been extremely well documented but I can do my best to walk you through how to do it. So the missing "table" link that will really help you get started is m2m_sp_widget_dependency table. From there you will be able to see that one record on that table will hold reference to the Dependency (sp_dependency table) and the widget itself (sp_widget table). The dependency will ultimately be loaded in as a UI Script (sys_ui_script table), in the script field I would just copy and paste the code you wanted into the script field. Part of the confusing layout of the sp_dependency is that you can included multiple JS includes (UI scripts) so you can keep a collection of dependencies; the reason I bring this up is because there is one last table to be concerned about which is the m2m_sp_dependency_js_include table. I hope this helps and if there is any more information I can provide on how achieve what you are accomplishing please let me know, I will be happy to spend some more time with you and this requirement.



Best Regards,
    Philip Engles
    philip.engles@techport13.com


find_real_file.png