Need to query flow context sys_id

Bird1
Mega Sage

Hello,

 

I would like to query the flow context's sys_id on one of record producer. I tried with below script.

 

 

var flow = new GlideRecord('sys_flow_context');
flow.addQuery("source_record", "349dff2d1b0f591037e598aebd4bcbcf");


flow.query();
gs.info(flow.sys_id);

 

 

But the result I got is 

*** Script: undefined

 

Can anyone help to advise? 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Bird1 

you should use next() function to print

var flow = new GlideRecord('sys_flow_context');
flow.addQuery("source_record", "349dff2d1b0f591037e598aebd4bcbcf");


flow.query();

flow.next();
gs.info(flow.sys_id);

 

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

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Bird1 

you should use next() function to print

var flow = new GlideRecord('sys_flow_context');
flow.addQuery("source_record", "349dff2d1b0f591037e598aebd4bcbcf");


flow.query();

flow.next();
gs.info(flow.sys_id);

 

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