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

Hi @Swapnil Soni , 

 

Could you please provide sample script include for this, How to call system property in script include.

 

Thanks,

Prasad.

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,

Swapnil

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Ankur as 100% correct when it concerns Platform UI. Go for a Business Rule which sets the scratchpad. Going for a Script Include only makes sense when working on the Service Portal.

Just wanted to add:
For the Platform UI, you might find this utility helpful, creates a Related Link with which you can easily see which scratchpads are available (out-of-the-box and what you added) and what the contents is:
"Show Contents of g_scratchpad" Tool

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Henry,

Any update on this?
Can you mark my answer as correct, 👍 helpful if you were able to achieve the requirement. This enables other members to learn from this thread.

Regards
Ankur

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