Getting Undefined Value

abirakundu23
Mega Sage

Hi All/  @Murthy Ch ,

Created schedule job that set case assignment to automatically. But adding add() or addDays() logic we get 'undefined' value through log. Could you please help me ?

var caseupdate = new GlideRecord("sn_hr_le_case");
caseupdate.addEncodedQuery('active=true');
caseupdate.query();
gs.info("case test123");
while(caseupdate.next())
{
var date = new GlideDateTime();
gs.info("case test1234");
var date1 = new GlideDateTime(caseupdate.opened_at);
gs.info("case test1245");
gs.info("Created date:" +date1);
var days= date1.add(2);

gs.info("Add days:" +days);    // getting log 'Undefined'
if(date == days && caseupdate.u_country == 'IN')
{

caseupdate.assignment_group = '' ;//sys_id of the group
gs.info("Case assignment successfully");
}
}
gs.info("Case assignment successfully12");

 

11 REPLIES 11

Hi @Community Alums ,

I have added 6 days according to case opened date & current date instead of adding 2 days. but still its not working.

Community Alums
Not applicable

Hi @abirakundu23 ,

May be you can create one field may be you can not display on the form view in which you can store added days value and than you can compare both the days. May be this will works for you

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards

Sarthak