Can you please share a screenshot of script include. Can you please confirm if script include "Accessible from" is set to all application scope?


Of course ...



5-3-2017 3-15-22 PM.png



The "Accessible From" field WAS incorrectly set. I've changed it to "all application scopes" (as showing above). PROGRESS!


Now I'm getting the second prompt from my original post ( alert('into doSomething'); ) but the last alert that returns an answer is still coming back as "null".


Thanks for the update Sue. Replace script include with below updated code.


var ClientDateTimeUtils = Class.create();


ClientDateTimeUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {


  addDateAmount: function(){



  var firstDT = this.getParameter('sysparm_fdt'); //First Date Field


  var addTYPE = this.getParameter('sysparm_addtype'); //What to add - day (addDays()), week (addWeeks()), month (addMonths()), year (addYears())


  var addTIME = this.getParameter('sysparm_addtime'); //How much time to add


  var day = GlideDate();


  day.setValue(firstDT);



  if(addTYPE == 'day'){day.addDays(addTIME);}


  else if (addTYPE == 'week'){day.addWeeks(addTIME);}


  else if (addTYPE == 'month'){day.addMonths(addTIME);}


  else if (addTYPE == 'year'){day.addYears(addTIME);}


  else {day.addDays(addTIME);}



  //return "First Date: " + firstDT + " -Time to Add: " + addTIME + " -Add Type: " + addTYPE + " -Added Time: " + day;


  return day;


  },



  _privateFunction: function() { // this function is not client callable



}




});



View solution in original post

I'll give that a try too, but first I did find an error in my client script.



var cdt = g_form.getValue(newValue); //Choose the field to add time from


  should be


var cdt = newValue; //Choose the field to add time from



Now I'm actually passing in the correct parameter, but I'm still getting a null result to let me try your next suggestion.



EUREKA!!!


That worked.  



It looks like the only difference is the addition of this line outside the 'addDateAmount' function:



_privateFunction: function() { // this function is not client callable



What does this line do?


If I add further functions into this script include should this line be at the very end of the script include or is it repeated with each function?



Thank you SO MUCH for your help.