- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 11:25 PM
I have various Scheduled Scripts that are failing to Execute, even when I click the Execute Now button. We paid a vendor to come in and code this for us but I believe there may be a fault or issue in how they coded this. The encoded query is working as intended as I opened the table and applied the same filters that you see below and that provided a list of cases. However, this leads me to believe that the code itself is bad or not working as intended. This job is to run when the encoded query is satisfied > a notification email is then shot off because it's trigger is this event firing off. Please let me know where the code is wrong or incorrect.
var gr = new GlideRecord("sn_hr_core_case_operations");
gr.addEncodedQuery('active=true^hr_service=680a02079f1322003be01050a57fcf85^u_actual_return_dateISEMPTY^u_select_the_type_of_leave_you_would_like_to_request=Continuous');
gr.query();
while (gr.next()) {
var dueDate = new GlideDate();
dueDate.setValue(gr.u_approved_start_date);
var today = new GlideDateTime();
var diff = new GlideDuration();
diff = GlideDate.subtract(today, dueDate).getRoundedDayPart();
gs.info("Diff: " + diff + " " + gr.number);
if (diff == '-172')
gs.eventQueue('sn_hr_core.6month.prior.to.expectedstart', gr, 'LOA@email.com');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 01:13 AM
Hi
Can you check the "Run As" field for the scheduled Job? I am assuming the "Run as" field would have a contractor account and not that contractor account is inactivated/disabled you script stopped running.
Update the script to the System Administrator account or any other active admin user in the system.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Sagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 09:14 PM
- Configure a service activity for an HR service.
- Configure the HR ticket page header for an HR service.
- Configure the HR case creation form for an HR service.
- Configure the HR case form for an HR service.
- Add a custom column (field) to an HR table