Array in client script Help!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2017 08:17 PM
Hi All, I have a assignment group list array in client script I want NOT to show a field if incident assignment group contains one of this group.
var arrayList = ['test1','test2','test3'];
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 06:07 AM
That is the expected output right to exclude None from the list?
the new array won't contain the None option
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 08:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 08:38 AM
Hi,
so if the only value is --None-- then you don't want to exclude
Only when None is present with other values you want to exclude
update as below
var field= current.getDisplayValue('list_field').toString();
var field2= field.split(',');
if(field2.length == 1 && field2[0] == '--None--'){
// use field2 directly no processing
}
else{
var newArr = [];
for(var i=0;i<field2.length;i++){
if(field2[i] != '-- None --'){
newArr.push(field2[i].toString());
}
}
gs.info('final arr without none' + newArr);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2022 12:38 AM
ArrayUtil won't work in client side scripting. I have tried it.