Push multiple values into glide list field?

sndev1099
Giga Expert

Hi, 

I need to push multiple values into a glide list field from records retrieved from gliderecord. Currently it's only pushing one value. Is there something simple I'm missing? I've logged it and the glide record is returning 5 records.

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

	var m2moim = new GlideRecord('x_lbg_insider_risk_m2m_catalog_acce_ir_access_ca');
	m2moim.addQuery('ir_access_categorisation', current.sys_id);
	m2moim.query();
	
	while (m2moim.next()) {
		
		//gs.info("AB 28_07 " + m2moim.sys_id);
		
		var entList = [];
		entList.push(m2moim.catalog_access);
		current.u_oim_entitlements = entList.toString();
	} 

})(current, previous);

 

find_real_file.png

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Brack,

Below please find the updated working code.

(function executeRule(current, previous /*null when async*/) {
  var entList = [];
    var m2Gr = new GlideRecord('x_lbg_insider_risk_m2m_catalog_acce_ir_access_ca');
    m2Gr.addQuery('ir_access_categorisation', current.sys_id);
    m2Gr.query();
    while (m2Gr.next()) {
        
        entList.push(m2Gr.catalog_access.toString());
    }
current.u_oim_entitlements = entList.join(); 

})(current, previous);

- Pradeep Sharma

View solution in original post

10 REPLIES 10

@bracken91 

It worked well for me using toString() on array.

Can you share the updated code so that it would help others as well.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader