Illegal access to private script include DurationCalculator in scope rhino.global being called from scope ?

nthumma
Giga Guru

I am getting follwong error after Helsinki upgrade on one fo my custom app.

Illegal access to private script include DurationCalculator in scope rhino.global being called from scope

Any thoughts ?

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Change the the script include so that it is accessible form all application scopes as shown below.



find_real_file.png


View solution in original post

7 REPLIES 7

Abhinay Erra
Giga Sage

use new global.DurationCalculator()


function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed.    


  gs.include('DurationCalculator');


  var time_elapsed = executeSample(current.opened_at,current.closed_at);


  var workday = 32400;


  var time_elapsed_1 = time_elapsed/workday;


  time_elapsed = time_elapsed_1.toFixed(1);


  current.turn_around = time_elapsed;


}


function executeSample(sDate,eDate) {


      // First we need a DurationCalculator object.


  var dc = new global.DurationCalculator();


  // The above sample is useful in limited cases. We almost always want to


  // use some schedule in a duration computation, let's load a schedule.


  addSchedule(dc);


  // Compute a duration using the schedule. The schedule


  // specifies a nine hour work day. The output of this is 32400 seconds, or


  // a nine hour span.


  dur = dc.calcScheduleDuration(sDate,eDate);


  gs.info("calcScheduleDuration with schedule with Dynamic Values: " + dur);


  return dur;


}


function addSchedule(durationCalculator) {


  //   Load the "8-5 weekdays excluding holidays" schedule into our duration calculator.


  var scheduleName = "8-5 weekdays";


  var grSched = new GlideRecord('cmn_schedule');


  grSched.addQuery('name', scheduleName);


  grSched.query();


  if (!grSched.next()) {


  gs.log('*** Could not find schedule "' + scheduleName + '"');


  return;


  }


  durationCalculator.setSchedule(grSched.getUniqueValue());


}



Can you tell me where exactly ? I am already using new global.DurationCalculator(); at line 12


Abhinay Erra
Giga Sage

Change the the script include so that it is accessible form all application scopes as shown below.



find_real_file.png


Thank You that worked