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 02:52 AM
Hi
I have a similar requirement
Like:
I have field (List field- dropdown with None), and we calling this field into email subject along with other fields by notification email script, So now we dont want to display none in the subject even if the user select by mistake
Basically we just want to remove --None--
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 03:01 AM
when you print that value in email script what it shows for --None--
You can accordingly exclude that value
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 03:07 AM
var field= current.getDisplayValue('list_field').toString();
var field2= field.split(',');
var field3= field2.splice(field2.indexOf('-- None --'), 1);
here i m printing field3 , this what the logic i have written but it doesnt seems to be working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 04:12 AM
Hi,
try iterating and create new array
var field= current.getDisplayValue('list_field').toString();
var field2= field.split(',');
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
‎10-28-2020 05:28 AM