Function getGlideObject is not allowed in scope sn_hr_core

leahdany
Giga Guru

I'm receiving an error whenever a case record's active status changes to false. This is within the scoped HR app Human Resources: Core. The error I'm getting is "Function getGlideObject is not allowed in scope sn_hr_core".

I tracked this down to an OOB business rule called "Update durations". This BR runs when active changes to false on the HR Case (sn_hr_core_case) and extended tables. The one line of script is: 

new hr_Case(current, gs).getCalendarDuration();

I traced that function back to two OOB script includes of the same name, different scopes. One is global and accessible from all application scopes. The other is in the Human Resources: Core scope with Caller Restriction and accessible from all application scopes. The name of both script includes is "hr_Case". The global API name is "global.hr_Case" and the scoped API name is "sn_hr_core.hr_Case". The function in question is below:

getCalendarDuration : function() {
var start = new GlideDateTime(this._case.getValue("opened_at"));
if (!start) {
return;
}
var end = new GlideDateTime();
end.setDisplayValue(new GlideDateTime().getDisplayValue());

var hrUtil = new sn_hr_core.hr_Utils();
var seconds = hrUtil.calcDuration(start, end);
//Convert seconds to milliseconds and gets the duration value
var duration = new GlideDuration(seconds * 1000);
this._case.calendar_duration = duration;
},

Since this script include is in fact in scope I'm not sure what the issue is here.

 

1 ACCEPTED SOLUTION

Kiel Sanders
ServiceNow Employee
ServiceNow Employee

I recommend creating a HI incident for this issue to have our Support Engineers look into the code and the error you are encountering.

View solution in original post

1 REPLY 1

Kiel Sanders
ServiceNow Employee
ServiceNow Employee

I recommend creating a HI incident for this issue to have our Support Engineers look into the code and the error you are encountering.