How to push GlideRecord query to an array

Pratiksha Lang1
Kilo Sage

How to push GlideRecord query to an array in a Before Query BR

Please find the code below:

I want to push the GlideRecord query to an array. 

Note : I have written this code on  a Before Query BR

 

var answer = [];
var grRole = new GlideAggregate('x_amspi_smdrs_app_role_matrix');
grRole.groupBy('site');
grRole.query();
while (grRole.next()) {
var grInp = new GlideRecord('x_amspi_smdrs_app_input_ola');
grInp.addQuery('site', grRole.site);
grInp.addQuery('role', 'DM');
grInp.query();
while (grInp.next()) {
gs.info('check code');
}

}

11 REPLIES 11

Bert_c1
Kilo Patron

You can review existing OOB business rules that run 'Before' and for 'Query'. Use syntax like:

 

answer.push('desired_field_value');

This doesn't work @Bert_c1 

works for me, not sure why it doesn't work for you, see other replies here.

Pratiksha Lang1
Kilo Sage

@Harshwardhan Can you please help me on this?