Filter based on assignment group in sys_journal_field table.

VasukiS
Tera Guru

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.

 

VasukiS_0-1747415466799.png

VasukiS_1-1747415526927.png

Anyone please help me how to achieve this ?

 

Chaz
Tera Guru

In your condition you need to initialize the script include so it will need to be
javascript: new getelementID()

@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. 

 

VasukiS_0-1747739925038.png

 

Hello, it's probably because it's returning the array.

Try returning it as a string

 

return arrUser.toString();

yes i have tried to change the script with few method but showing the same issue.