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:05 PM
Hi Vijay,
Please try using this syntax:-
It's giving the correct result for me.
var names = ['D', 'B', 'A', 'A', 'C', 'A'];
var unique = [...new Set(names)];
console.log(unique);
// Output---> ["D", "B", "A", "C"]
Please mark my answer as correct if it has helped you.
Regards
Santosh Kshirsagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2018 11:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2018 11:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2018 08:40 PM
Use the built in ArrayUtil Script Include :
var noDuplicates = new ArrayUtil().unique(arr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2019 10:59 PM
Can you mark the answer as Correct if it helps you?