Parsing error in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2020 12:10 AM
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.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 01:08 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader