Share Client Script with different forms/apps?

NatG
Tera Contributor

Hello Community,

 

Currently i have a client script attached to one particular form with onLoad function.

It pulls data for Select Box from the external API.

Is it possible to store that script in Servicenow shared/global location so i can use it on other different forms or even forms in different apps?

 

Thank you, 

Natasha

2 ACCEPTED SOLUTIONS

Kami
Giga Expert

Hi @NatG ,

Yes, you can put the script in UI Script, here is the example:

1. Create the UI Script in Global, please see the following screenshot

2.png

2. Call this script from Global Application OR from other Scoped Application:

3.png

View solution in original post

DYCM
Mega Sage

Hi @NatG ,

Yes, you can put the script in UI Script. Here is the example.

1. Create the UI Script in Global, please see the following screenshot.

DonaldYangCM_0-1695472799142.png

 

2. Call the script from Global OR other Scoped Applications.

DonaldYangCM_1-1695472799217.png

 

 

View solution in original post

3 REPLIES 3

-O-
Kilo Patron
Kilo Patron

Yes, you can add the code to a UI Script.

UI Scripts can be loaded into various places using various methods.

I suppose the most wildly available is using the ScriptLoader.getScripts() call.

Kami
Giga Expert

Hi @NatG ,

Yes, you can put the script in UI Script, here is the example:

1. Create the UI Script in Global, please see the following screenshot

2.png

2. Call this script from Global Application OR from other Scoped Application:

3.png

DYCM
Mega Sage

Hi @NatG ,

Yes, you can put the script in UI Script. Here is the example.

1. Create the UI Script in Global, please see the following screenshot.

DonaldYangCM_0-1695472799142.png

 

2. Call the script from Global OR other Scoped Applications.

DonaldYangCM_1-1695472799217.png