The CreatorCon Call for Content is officially open! Get started here.

Parsing error in script include

Sanjeeva Nagend
Tera Contributor

Hi all,

 

I am actually working on a script include where I am declaring a function inside a function, to glide the schedule table. However, I am receiving an error. Error is 'Parsing error: Unexpected token error', Below is the script I have written,

 

Script Include:

var Test = Class.create();
Test.prototype = Object.extendsObject(AbstractAjaxProcessor, {
reqDueDateValid:function()
{
var flag = '';
var dueDateTime=this.getParameter('sysparm_date');
var userNam=this.getParameter('sysparm_user');
var urgent = this.getParameter('sysparm_urgent');
if(urgent == 'Yes'){
gs.log("End Date1:"+urgent);
var dc = new DurationCalculator();
dc.setStartDateTime(new GlideDateTime(gs.nowDateTime()));
addSchedule(dc,'8-5 weekdays');
dc.calcDuration(4*3600);
var endDate='';
endDate=dc.getEndDateTime();
return endDate;
gs.log("End Date:"+endDate);
gs.log("End Date3:"+endDate);}
}
function addSchedule(durationCalculator,schedule) {
gs.log("End Date3:"+schedule);
var grSched = new GlideRecord('cmn_schedule');
grSched.addQuery('name', schedule);
grSched.query();
if (grSched.next()) {

return durationCalculator.setSchedule(grSched.getUniqueValue(), "GMT");

}
},
type: 'Test'
});

 

Please suggest.

5 REPLIES 5

@Sanjeeva Nagend 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader