- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2021 11:23 PM
Hello!
I am trying to pass an array of values to addQuery, but I am not getting the desired output.
Form a previous code snippet, I get an array of CI sys IDs (arrayCI, suppose), which is also correct. I have verified that. I have to pass this array to below gliderecord.
Below is that sample of code:
var totalCount=0;
var taskCIObject = new GlideRecord('task_ci');
taskCIObject.addEncodedQuery(<<some encoded query>>); //which is working fine
taskCIObject.addQuery(<<pass the array that I got previously>>); //not sure of the syntax
taskCIObject.query();
while(taskCIObject.next())
{ totalCount = totalCount +1;} //the count is getting wrongly computed
gs.addInfoMessage('Count = '+totalCount);
I want to get the count of records for which the set of CIs is exact same.
Can anyone please help me solve the above?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2021 12:34 AM
Hi,
is array contains CI sys_ids then do this
taskCIObject.addQuery('ci_item', 'IN', arr.toString());
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2021 12:34 AM
Hi,
is array contains CI sys_ids then do this
taskCIObject.addQuery('ci_item', 'IN', arr.toString());
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader