Getting Display Names from List Not an Array???
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I'm gathering all my notification records from my custom table and gathering what is in the "allow_opt_in" field. Then I'm comparing the array with what is in the typeUser variable and if there is a match, push the sys_id to an array.
This only works if Facility User is the first array in the list.
If I swap out optIn with "Facility Admin, Facility User" it works fine. But getting optIn from "grNotifications.getDisplayValue('allow_opt_in');" it's not working.
var array = [];
var typeUser = 'Facility User';
var arrayUtil = new global.ArrayUtil();
var optIn = '';
var grNotifications = new GlideRecordSecure('My Notification Table');
grNotifications.query();
while (grNotifications.next()) {
optIn = grNotifications.getDisplayValue('allow_opt_in');
var optInSplit = optIn.split(',');
var arrayAnswer = arrayUtil.indexOf(optInSplit, typeUser);
if (arrayAnswer >= 0) {
array.push(grNotifications.sys_id.toString());
}
}
0 REPLIES 0
