- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 08:28 AM
Hi all,
what's the easiest way to pass (embed / force) server-side information into a Glide form?
The background of the question is,
I want to enable/disable a control in the form sys_user_grmember depending on the type of the group. (Group type is notoriously a list of records in table Group Type).
Best if I don't have to operate with type sys_id but rather with type name.
Querying this information on the client side is a nightmare, I have to find out first sys_id of the group type in question, then get reference to the group (remember, we are in sys_user_grmember so group.type is not available straight away), and finally enable/disable my control based on the list search result.
It feels somehow complex. I'd rather force some data into the form at the server side, before the form gets loaded, and then just use this data in the form directly, without roundtrip to the server.
Thank you!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 08:30 AM
If the server information is NOT dependent on changing information on the client (e.g. push it once and forget it) then your best bet is with the g_scratchpad object. Set the properties in a display business rule, then the client script has access to the same properties.
Docs: Client Scripts
Client Script Best Practices - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2016 10:47 AM
The display business rules don't query on every record. They are only called when a form is displayed. You may be confusing this with query business rules.
Display business rules populating the g_scratchpad is an extremely efficient way of doing a one-time push of content from the server to the client with minimal scripting. If you need dynamic content (if field A changes from value 1 to 2, then go to the server and get new content) then we're talking a bit more complex round-trip.
Reference:
Business Rules - ServiceNow Wiki
Business Rules Best Practices - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 12:29 AM
In this case I'm going for it, thanks Chuck!