How to get System Property at Client Side?

Comp henry
Giga Contributor

How to get any System Property at Client Side ?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Henry,

unfortunately you could not since gs.getProperty('name') only works in server side

Also performing GlideRecord in client side is not recommended

Are you referring to use that in onload client script of some table; if yes then you can use display business rule on that table; get the property value and store in scratchpad variable and use that variable in onload client script

BR: 

g_scratchpad.propertyValue = gs.getProperty('property_name');

Client Script:

function onLoad(){

var propertyValue = g_scratchpad.propertyValue;

}

If you are referring to using it in catalog then perform GlideAjax and use script include to get the value and return it from function

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Henry,

unfortunately you could not since gs.getProperty('name') only works in server side

Also performing GlideRecord in client side is not recommended

Are you referring to use that in onload client script of some table; if yes then you can use display business rule on that table; get the property value and store in scratchpad variable and use that variable in onload client script

BR: 

g_scratchpad.propertyValue = gs.getProperty('property_name');

Client Script:

function onLoad(){

var propertyValue = g_scratchpad.propertyValue;

}

If you are referring to using it in catalog then perform GlideAjax and use script include to get the value and return it from function

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hi Ankur,

How do you do it for a global business rule. The type When=display option it not available.

Regards,

Peter

Hi Peter,

don't do it for global table; example below for incident table:

BR: when -> display

find_real_file.png

find_real_file.png

Client Script:

function onLoad(){

alert(g_scratchpad.propertyValue);

}

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Swapnil Soni1
Giga Guru

Hi Comp,

 

1.Create a script include.Use gs.getProperty in that script include.

2.Call the previously created script include from client script.

 

 Please mark correct or helpful if this solve your issue.

 

Thanks,