Can I Use GlideRecord into UI Action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2017 07:07 AM
Hi guys,
I have a UI Action client-server. Can I use GlideRecord object? It's a good practice or I have to use GlideAjax with Script Include?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2017 07:13 AM
Hi Gaetano,
It is possible to use the GlideRecord API within UI actions. This is evident in countless 'out of the box' UI actions provided by ServiceNow. (See 'Subimt' UI Action for example on the Project Task Table) however some of this is dated code.
The real question is regarding what functionality you're trying to provide via the UI action. Its always recommended to use GlideAjax when making server calls (and async as a preference)
Please mark this response as correct and helpful via your post link (Can I Use GlideRecord into UI Action? ) to help others with the same question.
Thanks,
Robbie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2017 07:14 AM
FWIW, our developers wrote some of those years ago before best practices were recognized. Updating them seems to be a low priority. Case in point is the client script on the incident for that gets the location when the caller is changed. It's got a couple things that really need updating and unfortunately it keeps getting reused as an example for ways to do client updates.
FYI -
ServiceNow Wiki: Technical Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2017 07:22 AM
Thanks Chuck - appreciate the info.
I absolutely always recommend GlideAjax.... Its one of those cases, just because you can do something, it doesn't mean you should ; )
Cheers,
Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2017 07:14 AM
Please refer this post to understand on how to use the client and server code combined in a UI Action:
http://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2024 02:05 PM
Thanks for the answer @Alikutty A , it helped me to solve and understand this problem of using a client and server code combined in a UI Action.
P.S.: I spent days trying to solve it, and your answer brought me the solution.
Thank you very much!