- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 07:30 PM
I have tried the following method but it does not work.
var databaseView = 'x_xxxxxxxxxxxxxx';
var databaseViewRecords = new GlideRecord(databaseView);
databaseViewRecords.query();
var rows = databaseViewRecords.getRowCount();
var list = [];
for (var i = 0; i < rows; i++) {
pidList.push(databaseViewRecords[i].getValue('sys_id'));
}
error:
com.glide.script.RhinoEcmaError: The undefined value has no properties.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 07:41 PM - edited 11-03-2022 07:55 PM
Hi @KS18 ,
Please use the below script, it should work
var databaseView = 'x_xxxxxxxxxxxxxx';
var databaseViewRecords = new GlideRecord(databaseView);
databaseViewRecords.query();
//var rows = databaseViewRecords.getRowCount();
var list = [];
while (databaseViewRecords.next()){
list.push(databaseViewRecords.getValue('sys_id')); //All sys_id will be pushed to 'list' array
}
NOTE : Please note that Database view in actual is not a table, hence you would find it's sys_id little bit strange. It's not like any other table's 32 character long sys_id.
I hope this help.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2022 07:41 PM - edited 11-03-2022 07:55 PM
Hi @KS18 ,
Please use the below script, it should work
var databaseView = 'x_xxxxxxxxxxxxxx';
var databaseViewRecords = new GlideRecord(databaseView);
databaseViewRecords.query();
//var rows = databaseViewRecords.getRowCount();
var list = [];
while (databaseViewRecords.next()){
list.push(databaseViewRecords.getValue('sys_id')); //All sys_id will be pushed to 'list' array
}
NOTE : Please note that Database view in actual is not a table, hence you would find it's sys_id little bit strange. It's not like any other table's 32 character long sys_id.
I hope this help.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh