- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 10:05 AM
I am working on a requirement to provide a list of servers on a portal page.
I have two question.
1. How do i query the variable for the appcat request item should be equal to ac.sysid. Which would return all requests opened for 'this appcat'.
2. I am having trouble with querying the request items variables to the cmdb group table.
var user = gs.getUserID();
var ac = new GlideRecord(cmdb_ci_service_dashboard);
ac.addQuery('owned_by', user);
ac.query();
while(ac.next())
//find all patching automation requests opened for 'this appcat' (xactly)
{
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('varible_appcat', 612063dedb8dbf8091dd25894b96197a=ac.sys_id);
ritm.query();
//loop to get the list of servers
while(ritm.next()){
//How to get the CMDB groups (target machines) related to the request
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 10:18 AM
Hi Ashle,
I am not good at scripting, but have you looked at this ?: https://docs.servicenow.com/bundle/sandiego-application-development/page/script/server-scripting/concept/c_ScriptableServiceCatalogVariables.html
Regards.
JP
JP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 10:18 AM
Hi Ashle,
I am not good at scripting, but have you looked at this ?: https://docs.servicenow.com/bundle/sandiego-application-development/page/script/server-scripting/concept/c_ScriptableServiceCatalogVariables.html
Regards.
JP
JP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2022 04:09 PM
To get the value of a variable, you would call gr.variables.variable_name
.
I'm not sure what this line is supposed to do:ritm.addQuery('varible_appcat', 612063dedb8dbf8091dd25894b96197a=ac.sys_id);
A normal query structure would looke like:ritm.addQuery( 'fieldName', value );
An encoded query would look like:ritm.addEncodedQuery( 'fieldName=value' );