Getting Undefined Value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 04:14 AM - edited 04-12-2024 04:23 AM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 04:37 AM
Hi @abirakundu23 ,
Here's your code with some modifications:
var caseupdate = new GlideRecord("sn_hr_le_case");
caseupdate.addEncodedQuery('active=true');
caseupdate.query();
while (caseupdate.next()) {
var date1 = new GlideDateTime(caseupdate.opened_at);
gs.info("Opened date: " + date1);
var date2 = new GlideDateTime(); // Current date
date2.addDaysLocalTime(2); // Adding 2 days to current date
gs.info("Two days later: " + date2);
if (date1.equals(date2) && caseupdate.u_country == 'IN') {
caseupdate.assignment_group = ''; // Set assignment group to empty
gs.info("Case assignment successfully");
caseupdate.update(); // Update the record
}
}
gs.info("Case assignment completed");
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 05:32 AM
Hi @Ratnakar7 ,
After modifing the code still getting same log "Undefined" form this line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2024 07:48 PM
Could you please suggest me? in log getting 'undefined.'
var days= date1.addDaysLocalTime(2);
gs.info ("Add days:" +days); // getting undefined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2024 09:10 PM
Hi @abirakundu23,
Try with updated scripts -
var date1 = new GlideDateTime(caseupdate.opened_at.toString());
var days= date1.addDaysLocalTime(2);
gs.info ("Add days:" + days);
Thanks,
Sagar Pagar