Call a System Property in a UI Script

Brad Shedd
Tera Contributor

Hello,

We have a UI Script that creates a banner in the backend but needs to change one word of the text in different instances. What do you think is the best way to make this happen? I was thinking about creating an SYS Property with the verbiage on the banner, but how would I call that in the UI Script? Is there a better way to go about doing this? We have other places where this must happen, such as notifications and Portal Header. 

 

 

This is the first part of the UI Script, and the X's need to change:

var banner1 = {
text: 'Dynamic Content up to XXXXXX',
backgroundColor: '#027f07',
textColor: '#ffffff'
};

 

 

Thanks

1 ACCEPTED SOLUTION

Lisa1
Tera Expert

Hi Brad.

To achieve this requirement I did the following 3 things.

1. Created a new system property called banner.classification with whatever you want as the Value (which will be displayed in the banner later on).

 

2. Create a Script Include to pull the value from the system property. Client callable must be checked in order to use it in a client script later on.

 

Example code:

 

Lisa1_0-1684767835970.png

 

3. Add a client script into your UI script which will pull in the system property from your Script Include.

 

Lisa1_1-1684768219319.png

 

Hope this helps!

View solution in original post

3 REPLIES 3

Manmohan K
Tera Sage

Hi @Brad Shedd ,

 

Please check below article which shows how to call system property in UI script

https://www.servicenow.com/community/service-management-forum/how-do-i-access-the-system-property-in...

 

Lisa1
Tera Expert

Hi Brad.

To achieve this requirement I did the following 3 things.

1. Created a new system property called banner.classification with whatever you want as the Value (which will be displayed in the banner later on).

 

2. Create a Script Include to pull the value from the system property. Client callable must be checked in order to use it in a client script later on.

 

Example code:

 

Lisa1_0-1684767835970.png

 

3. Add a client script into your UI script which will pull in the system property from your Script Include.

 

Lisa1_1-1684768219319.png

 

Hope this helps!

Brad Shedd
Tera Contributor

Excellent, work!!!! Works, perfectly.