- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2019 01:41 PM
Hi,
I have a requirement for setting a field value as 5 business days minus the set date on the another field on a catalog form.
For example-
If the Delivery_Date is set as 11-15-2019, the Actual_Start_date should be 11-08-2019, taking into account the 8-5 weekday schedule.
Looking for on how to configure the Actual_Start_date.
The delivery date can be modified by the user submitting the request, so I know it should be a catalog client script, but I am quite new to coding and after thoroughly searching the community, could not find the answer I needed.
So requesting the ServiceNow Community for assistance.
Thanks.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 08:49 AM
Hi All,
I finally made is possible by following a minimal scripting method using the Timer.
As suggested by TJW in set a timer in workflow based on a variable, I was able to set the schedule and make the timer wait as per my needs.
Thank you all for your support 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2019 10:38 PM
Hi
Can you try this -
var AjaxDurCalc = Class.create();
AjaxDurCalc.prototype = Object.extendsObject(AbstractAjaxProcessor, {
durCalc: function() {
var deliver = this.gertParameter('sysparm_deliv');
var ps = new GlideDateTime(deliver);
ps.addDays(-5);
var datebefore = ps.getDate();
return datebefore.toString();
},
type: 'AjaxDurCalc'
});
Just added toString() in the return statement.
Try this and let me know.
Regards
Omkar Mone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2019 11:12 PM
Thank you Omkar for your response.
Tried it and still not working.
I even tested and submitted the request to see if may be the field is getting generated on submit, but no avail there too.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2019 11:17 PM
Hi
Can you put some log statements and check what you are getting?
I have put the logs, copy it and check it in the system logs -
var AjaxDurCalc = Class.create();
AjaxDurCalc.prototype = Object.extendsObject(AbstractAjaxProcessor, {
durCalc: function()
{
var deliver = this.gertParameter('sysparm_deliv');
gs.log("Date Recieved = "+deliver);
var ps = new GlideDateTime(deliver);
ps.addDays(-5);
var datebefore = ps.getDate();
gs.log("Date Before = "+datebefore);
//return datebefore.toString();
},
type: 'AjaxDurCalc'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2019 11:38 PM
Hi Omkar,
I updated the script include and checked the logs at syslog.list but could not find anything with Date Received or Date Before.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2019 11:41 PM
There is a spelling mistake on this line
var deliver = this.gertParameter('sysparm_deliv');
it should be
var deliver = this.getParameter('sysparm_deliv');