Using UI Script in Widget Controller

gratziela
Tera Contributor

Hi guys,

I have an issue during the development of one scoped application.

I have created one widget and I found one JS library which provides me the functions for implementing the functionality I want.

The problem is that I have tried to add this JS library as a dependency (UI Script) of this widget and call some functions from it but I couldn't find a way to do it.

First, I started with a simple scoped JS dependency (UI Script) creating one private function which returns one string and one public function that calls this private function.

After that I wanted to call this public function in the controller of the widget, but it didn't work.

So does anyone know how to create this SCOPED JS dependency and call the functions in it in the controller of the widget?

Thanks in advance!

 

 

 

3 REPLIES 3

Kalaiarasan Pus
Giga Sage

The information on adding dependency can be found here - https://docs.servicenow.com/bundle/london-servicenow-platform/page/build/service-portal/task/widget-dependencies.html

 

Make sure you have followed the steps listed here.

Thanks, but I mentioned that I have already created an UI Script. I am not able to call any function from there. If you can help me with that. 🙂 

The information you have stated are generic setup information and all I am stating is to make sure that you are followed the steps like adding name, Include on page load setting, creating the UI script and adding it back on the service portal dependency.

 

So I would ask you to check this link if the first one wasn't helpful and make sure you have followed all the steps.

https://community.servicenow.com/community?id=community_article&sys_id=78cb624fdb5edbc0fc5b7a9e0f961952