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 09:36 PM
No it is not working,
this is the ui action button where we r calling the script include
function getRelevantTasks() {
//Call Script Include to return relevant tasks for current case type
var ga = new GlideAjax('ACNReturnTasks');
ga.addParam('sysparm_name','returnTasks');//this is the method calling from script include
ga.addParam('sysparm_sys_id',g_form.getUniqueValue());
ga.getXML(relevantTasks);
function relevantTasks(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer != "")
openAddTaskPopup(answer);
//open addtask pop up is an ui page
function openAddTaskPopup(tasks) {
// var dialog = new GlideDialogWindow("sn_hr_core_acc_hr_add_task_popup");
var dialog = new GlideModal("sn_hr_core_ACN_addHoc_Tasks");
dialog.setWidth("500");
dialog.setTitle(getMessage("What type of task would you like to create?"));
// @author Nestor Paredes
//this will remove the tier 3 task from the tasks list, if
// the assignment group does not contain a tier 2 group.
//var associatedTables = removeTier3TaskRecord(tasks);
var associatedTables = tasks;
dialog.setPreference("sysparm_associated_task_tables", associatedTables);
dialog.setPreference("sysparm_parent_id", g_form.getUniqueValue());
dialog.setPreference("sysparm_table", g_form.getTableName());
dialog.render(); //Open the dialog
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 09:42 PM
Dude i can see that you have defined the same variable for array declaration and glide record , did you change it in your instance while checking
use var textArray = [];
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 09:53 PM
could u please rectify it where to change bcoz i already made some changes,i think u have all the information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 09:57 PM
i was changed it but how can i move this from newly added array to taskArray=[];,then only it will display in the ui action button

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2018 10:03 PM
sorry i am not clear about your request what you are asking about
i can understand you are calling script include in ui action but i dont see return tasks function of script include posted in your comments please post it to make it clear for me
The only thing what i want to tell is if you have an array with duplicate values to make it unique you can use unique function of array util as my initial comment posted above
Thanks,
Siva.