- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 10:16 AM
Hi Team,
I need to filter the data based on a particular assignment group from the HR Core Case table.
Since the element ID does not have one of the options, I have decided to write a script include and add those in the element ID filter.
I have tried below script, but it is showing as undefined.
Client callable is yes, and the script is active.
var getelementID = Class.create();
getelementID.prototype = {
initialize: function() {
},
getelementID: function() {
var arrUser = [];
var gr = new GlideRecord('sn_hr_core_case');
gr.addQuery('assignment_group', 'e26a8785dbd5c150dbc71a8c139619a9');
gr.addQuery('state',1);
gr.query();
while (gr.next()) {
arrUser.push(gr.sys_id.toString());
}
gs.info('getelementID: ' + arrUser); // Log the array for debugging
return arrUser;
},
type: 'getelementID'
};Filter script : javascript:getelementID.getelementID()
Name of the script include is getelementID.
Anyone please help me how to achieve this ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 01:20 PM - edited 05-16-2025 01:20 PM
In your condition you need to initialize the script include so it will need to be
javascript: new getelementID()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 04:18 AM
@Chaz I have tried these method but still I am getting error it is populating as [object object].
I have modified the script include with few other methods but same issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 07:18 AM
Hello, it's probably because it's returning the array.
Try returning it as a string
return arrUser.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 05:33 AM
yes i have tried to change the script with few method but showing the same issue.