- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 07:48 PM
I want to get the list of all the ITEMs from all of my SCTasks.
1. Get all SCTasks assigned to is (dynamic) one my groups. (assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744)
2. Get all Items from all the SCTasks in the query. SCTASK > RITM > RITM.ITEM
3. Create an array, push all sysid of the 'ITEM' related to me inside the array, there should be no duplicates.
4. Return the array of all 'ITEM'.
Huge thanks to anyone who can help!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 10:11 PM
Hey @symonflores_23,
Something like below will help you;
var sctaskGr = new GlideRecord('sc_task');
sctaskGr.addEncodedQuery("assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744");
sctaskGr.query();
var itemArr = [];
while (sctaskGr.next()) {
itemArr.push(sctaskGr.request_item.cat_item.toString());
}
var arrUtil = new ArrayUtil();
return arrUtil.unique(itemArr);
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 10:11 PM
Hey @symonflores_23,
Something like below will help you;
var sctaskGr = new GlideRecord('sc_task');
sctaskGr.addEncodedQuery("assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744");
sctaskGr.query();
var itemArr = [];
while (sctaskGr.next()) {
itemArr.push(sctaskGr.request_item.cat_item.toString());
}
var arrUtil = new ArrayUtil();
return arrUtil.unique(itemArr);
Cheers