remove duplicates from an array and get unique values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 08:54 PM
var text=[];
text = new GlideRecord("sn_hr_core_hr_tasks_per_case_type");
text.addEncodedQuery("u_task_visibilityLIKE" + topicCat + "^ORu_task_visibilityISEMPTY");
text.addQuery("u_generation_type", "manual");
text.addNullQuery("u_auto_group_pref","test");
text.query();
while(text.next()) {
taskArray.push(text.getUniqueValue());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 10:11 PM
thanks bro but it ia huge task bcoz it includes another table to display tasks in popup,i coulnot able explain it to u.but the error is in returning some tasks but whenever i click ui action it is returning duplicates.if u know how to copy from one array to another plz let me know

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 10:49 PM
var arr = ["k","v","s"];
var arr2 = arr.slice(0);
arr is copied into arr2
Thanks,
Siva

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2018 11:31 PM
Can you please check if that solved your issue and Mark the appropriate response as correct and close this thread so that it can be removed from unanswered category
Thanks,
Siva

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2019 09:44 AM
Hello ,
Can you please check if that solved your issue and Mark the appropriate response as correct and close this thread so that it can be removed from unanswered category
Thanks,
Siva

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 09:35 PM
HI,
Use this:
var arrayUtil = new ArrayUtil(); var a1 = new Array("a", "b", "c", "c", "b"); gs.print(arrayUtil.unique(a1));
https://community.servicenow.com/community?id=community_question&sys_id=9a3dc7a9db9cdbc01dcaf3231f961908
Thanks,
Ashutosh