Script Issue: Not proceeding and no log comments

jlaps
Kilo Sage

I am having trouble with a conditional script on a scheduled report, and when I tried to take that out into its own scheduled script, seeing the same issue. I am not able to get past the first log statement- nothing else to go on. What I am doing wrong?

 

I get the JAL start at the top, but nothing else happens at all. This is a straight scheduled script execution, non-scoped, on demand. Why can I not set a variable or do any normal script things, and cannot even get to the "got here 1" log statement? Thanks!

 

gs.log('JAL start');
var scheduleReport = new GlideRecord('sysauto_report');
scheduleReport.get(db5dfa1ddbe431102620230bd39619a9); //Sys ID of your schedule Report
gs.log('JAL got here 1');
var tablename = scheduleReport.report.table;
var query = scheduleReport.report.filter;
var users = '';
gs.log('JAL got here 2');
gs.log('JAL ' +tablename + ' ' +query + ' ');
//Execute the report as a GlideRecord with the set table and condition
var gr = new GlideRecord(tablename);
gr.addEncodedQuery(query);
gr.query();
while (gr.next()) {
   users += ',' + gr.approver;
   gs.log('JAL ' +gr.approver);


scheduleReport.user_list = users;
scheduleReport.update();
}

 

1 ACCEPTED SOLUTION

Peter Bodelier
Giga Sage

Hi @jlaps,

 

You forgot quotes around the sys_id:

gs.log('JAL start');
var scheduleReport = new GlideRecord('sysauto_report');
scheduleReport.get('db5dfa1ddbe431102620230bd39619a9'); //Sys ID of your schedule Report
gs.log('JAL got here 1');
var tablename = scheduleReport.report.table;
var query = scheduleReport.report.filter;
var users = '';
gs.log('JAL got here 2');
gs.log('JAL ' +tablename + ' ' +query + ' ');
//Execute the report as a GlideRecord with the set table and condition
var gr = new GlideRecord(tablename);
gr.addEncodedQuery(query);
gr.query();
while (gr.next()) {
   users += ',' + gr.approver;
   gs.log('JAL ' +gr.approver);


scheduleReport.user_list = users;
scheduleReport.update();
}

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

3 REPLIES 3

Peter Bodelier
Giga Sage

Hi @jlaps,

 

You forgot quotes around the sys_id:

gs.log('JAL start');
var scheduleReport = new GlideRecord('sysauto_report');
scheduleReport.get('db5dfa1ddbe431102620230bd39619a9'); //Sys ID of your schedule Report
gs.log('JAL got here 1');
var tablename = scheduleReport.report.table;
var query = scheduleReport.report.filter;
var users = '';
gs.log('JAL got here 2');
gs.log('JAL ' +tablename + ' ' +query + ' ');
//Execute the report as a GlideRecord with the set table and condition
var gr = new GlideRecord(tablename);
gr.addEncodedQuery(query);
gr.query();
while (gr.next()) {
   users += ',' + gr.approver;
   gs.log('JAL ' +gr.approver);


scheduleReport.user_list = users;
scheduleReport.update();
}

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Well, that is embarrassing! I had put the sys_id in direct after changing from the conditional script, but I had the same issue there. Thank you!

We all have one of those days sometimes. 😉


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.