Glide Record Scripting - How to print or log result store in object

Luis Roman1
Tera Contributor

How can I print or display the values that I push to the variable name "records"? Your education on how to will be appreciated, Luis

SCRIPT BELOW:

var records;
var rec_id = [];
var grApprovalQueue = new GlideRecord('incident');
grApprovalQueue.addEncodedQuery('priority=2^category=inquiry');
grApprovalQueue.query();
while (grApprovalQueue.next()) {
rec_id.push('Record Id: '+grApprovalQueue.incident);
}
records = rec_id.join();

1 ACCEPTED SOLUTION

Use gs.info(records); in flow designer.

Then you can check the logs in syslogs table.

Refer: https://docs.servicenow.com/bundle/quebec-platform-administration/page/administer/time/reference/r_S... 


Raghav
MVP 2023

View solution in original post

3 REPLIES 3

RaghavSh
Kilo Patron

Try below:

var records;
var grApprovalQueue = new GlideRecord('incident');
grApprovalQueue.addEncodedQuery('priority=2^category=inquiry');
grApprovalQueue.query();
while (grApprovalQueue.next()) {
 record=grApprovalQueue.number+","+record;
}

gs.print(record);


Raghav
MVP 2023

RaghavSh, if I use the script below in a Script Action in Flow designer the record is blank. Does not contain any data. Therefore, I thought that to print it in Flow Designer I need to use an object array. However, I am learning so is there any changes that I need to make to what you suggested in order to make it work in the Flow Designer Script step? Appreciated the education and collaboration.

Use gs.info(records); in flow designer.

Then you can check the logs in syslogs table.

Refer: https://docs.servicenow.com/bundle/quebec-platform-administration/page/administer/time/reference/r_S... 


Raghav
MVP 2023