Set multiple sys_id's to glide_list field

sndev1099
Giga Expert

Hi,

I need to push multiple values to a glide list field. Currently it's only pushing one sys_id and I'm not sure how to push all values from the gliderecord record. Script below:

(function executeRule(current, previous /*null when async*/ ) {

    var entList = [];
    var m2moim = new GlideRecord('x_lbg_insider_risk_insider_access_lookup');
    m2moim.addQuery('sys_id', current.ir_access_categorisation);
    m2moim.query();
	
    while (m2moim.next()) {
		
        entList.push(current.getValue('sys_id'));

		m2moim.u_oim_entitlements = entList.join(',');
		m2moim.update();
	}
		
})(current, previous);

find_real_file.png

5 REPLIES 5

Hitoshi Ozawa
Giga Sage
Giga Sage

Haven't tested this yet but something like below.

(function executeRule(current, previous /*null when async*/ ) {

    var entList = [];
    var m2moim = new GlideRecord('x_lbg_insider_risk_insider_access_lookup');
    m2moim.addQuery('sys_id', current.ir_access_categorisation);
    m2moim.query();
	
    while (m2moim.next()) {
        entList.push(current.getValue('sys_id'));
	}
	m2moim.u_oim_entitlements = entList;
	m2moim.update();
		
})(current, previous);