Bulk Case Creation - Scheduled job issue

Rob Sestito
Mega Sage

Hey SN Comm!

Around 3pm yesterday, Nov 12th, I went to 'Create Bulk Cases' --> downloaded the email template --> added two users emails as a test (myself included) --> uploaded that file with the two emails --> the system file load was successful and it showed as finding myself and the second person --> I checked the box to have all cases have same Opened for and selected a person from my team that handles cases --> I used the HR Service 'Employee Profile Update' which automatically filled in the Short Description Field from the bulk case creation form --> I then went to the Bulk Case Creation scheduled job and clicked execute...

When I go to the Bulk Case Requests which shows my one request, I click into it, and it shows as running... this morning, several hours later, it still shows as running (In Progress).

Has anyone ever had this issue before? Does the Bulk Case Creation scheduled job only work with certain hr services?

Looking for any ideas as to why it would take this long.

Cheers!

-Rob

Bulk Request:

find_real_file.png

 

Scheduled Job Bulk Case Creation:

find_real_file.png

 

Condition Script:

var result = true;
var grCase = new GlideRecord('sn_hr_core_bulk_case_request');
grCase.addQuery('status','in_progress');
grCase.query();
if(grCase.next()){	
	result=false;
    gs.info(grCase.number+" is currently running");
}
result;

Run this Script:

var grCase = new GlideRecord('sn_hr_core_bulk_case_request');
grCase.orderBy('requested_time');
grCase.addQuery('status','ready');
grCase.query();
while(grCase.next()){
	var createCases = new sn_hr_core.hr_BulkCaseCreation().createCasesFromQuery(grCase.sys_id,grCase.user_selection_query,grCase.default_values,grCase.has_parent,grCase.selected_user_count,grCase.user_selection_type);
	grCase.url = createCases.url;
	grCase.update();
}
1 ACCEPTED SOLUTION

KirstinR
Mega Expert

Does the "Run as" on the scheduled job have the correct access (roles for HR cases)?

View solution in original post

15 REPLIES 15

I do have one of our test instances that is currently on New York, so trying it there as well.

However between both New York and Madrid Instance, I see the following system log warnings:

	org.mozilla.javascript.EcmaError: Cannot read property "url" from undefined
Caused by error in <refname> at line 7

4: grCase.query();
5: while(grCase.next()){
6: var createCases = new sn_hr_core.hr_BulkCaseCreation().createCasesFromQuery(grCase.sys_id,grCase.user_selection_query,grCase.default_values,grCase.has_parent,grCase.selected_user_count,grCase.user_selection_type);
==> 7: grCase.url = createCases.url;
8: grCase.update();
9: }

put this line to see what is in the createCases object

 

gs.log(JSON.stringify(createCases));

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

I receive the same error as before.

Note: had to change gs.log into gs.info as gs.log is not permitted in scoped application.

I still get a warning stating: 

org.mozilla.javascript.EcmaError: Cannot read property "url" from undefined
Caused by error in <refname> at line 7

KirstinR
Mega Expert

Does the "Run as" on the scheduled job have the correct access (roles for HR cases)?

The "run as" field by default is not on the scheduled job form. Once I added it however to see if it was holding any data, that field is blank.

find_real_file.png

 

Would this need something? since it is a scheduled job that is supposed to run periodically every 6 hours OOTB, would putting someone under this field help (as in, put myself in this field as the admin?).