GlideRecords in Discovery Patterns
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2020 12:46 AM
Hey team,
Is it possible to use GlideRecords when evaluating JavaScript in Discovery Pattern steps?
If yes, does it have an impact besides perhaps a longer execution time?
I'd like to check the Server table (cmdb_ci_server) and return a hostname for a particular IP Address but I'm wondering whether I can fetch that info directly in the pattern or if I should use some pre/post processing script?
Thanks in advance,
Fares.
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2020 01:01 AM
You can create a script include function,call the script include and store the result in a pattern variable :
javascript: new Script_Include().function();
Please go through this article to get your reply :
https://community.servicenow.com/community?id=community_blog&sys_id=c0ac2225dbd0dbc01dcaf3231f96198d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2020 05:16 AM
It actually is possible to do a glide record query. I will give you this warning though it is a bit slow in returning results and the glide record class that is used by the MID server has a limited feature set to what you are use to server side.
https://community.servicenow.com/community?id=community_Blog&sys_id=49ae725bdbcb93085ed4a851ca961999
Take a look at that post by Richard as I've used a similar technique before to look up records but be VERY sparing with it as it does have some low performance (essentially the MID server ends up having to make an API request back into ServiceNow to do the glide record lookup). Let me know if you run into any issues (the section you will want is near the following line in the article STEP 3: Create a custom Connection Section on an application component to connect to the Agent.