- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 03:53 AM
Hi
I'm trying to remove 1 element from an array, but I'm a little stuck on how to do it.
I have a watch list where the callers manager gets added it to, so, if the callers manager changes, I need to remove the old callers manager from it.
I've got far:
updateWatchList();
function updateWatchList() {
var oldCallerMgr = previous.caller_id.manager;
var wList = current.watch_list;
var arr = [];
var newWList = [];
arr = wList.split(',');
var i = 0;
for (; i < arr.length; i++) {
if (arr[i]!= "") {
var existWList = arr[i];
gs.log('existWList person is - ' +existWList);
if (oldCallerMgr != arr[i]) {
newWList.push(existWList);
}
}
}
gs.log('newwatch list is - ' +newWList); //This seems to be correct
current.watch_list = newWList;
gs.log('my new watch list is - '+current.watch_list); //it comes out org.mozilla.javascript.NativeArray@13bae85
}
It seems to work barr the current.watch_list - newWList? I get the org.mozilla.javascript.NativeArray@13bae85 error?
Any help is appreciated
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 04:39 AM
Hi Pennie,
current.watch_list expects string. You need to join the array first in LineNumber 22
current.watch_list = newWList.join(',');
gs.log('my new watch list is - '+current.watch_list); //it comes out org.mozilla.javascript.NativeArray@13bae85
Thanks
Srini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 04:50 AM
Thank you all for your help, the easiest one I found to update my code was Srinivas:
current.watch_list = newWList.join(',');
Adding that code in removed the old manager, so I just added a little more code above it to add the new manager and it works a treat
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 09:47 PM
Hi Pennie,
I have the same requirement in which in the oldCallerMgr - I have more than one value how to check that?
Regards,
Sundar