The CreatorCon Call for Content is officially open! Get started here.

why the script doesn't working in scheduled job but the same code works in background script.

Pallavi16
Kilo Contributor

The script in schedule job is not working and logs also not printing but the same code works in background script.

11 REPLIES 11

Subhankar Pram2
Tera Contributor

Is ur scheduled job active?? If yes , can u share the code here

 

var gru = new GlideRecord('sys_report');

gru.addQuery('sys_id', 'ae8a4aa9db24ff081787944bdb96198e');

gru.query();

if(gru.next()) {

var z_now = gs.nowNoTZ();

var d1=CRA_CalDateOf('d', +4, z_now, true);

var d2=CRA_CalDateOf('d', +7, z_now, false);


var c='08:00:00';

var t= d2+' '+c;

var newfilter="parent.sys_class_name=change_request^parent.ref_change_request.start_date>="+d1+"^parent.ref_change_request.start_date<="+t+"^ORparent.ref_change_request.end_date>="+d1+"^parent.ref_change_request.end_date<="+t+"^assignment_group=84b5f5152b446e0072751cf405da1555^approvalINapproved";

 

gru.filter=newfilter;

gru.autoSysFields(false);

gru.setWorkflow(false);

gru.update();

gs.print(gru.filter);

 

}

In this script we are updating the filter condition of the report.

Voona Rohila
Mega Patron
Mega Patron

Hi pallavi

Looks like you already raised a post(https://community.servicenow.com/community?id=community_question&sys_id=505f715ddb4681d0a53882630596...)

are both the same issues? 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

yes