- 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 11:48 PM
I literally thought this would now get fixed and I would have been sobbing because of this spelling mistake but still nothing.
I tried the old Script Include, then the one suggested by Omkar adding toString() and then tried changing the Delivery Date manually on the form on both cases, but still blank on all levels.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2019 11:54 PM
Hi
With the updated spelling mistake. does it still give blank on logs? If yes then i would suggest you to create a new Client callable script include and call it from the client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2019 12:04 AM
Yes, I did that and no logs.
Also created a new client callable Script Include and also a catalog client script, still nothing 😞

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2019 12:06 AM
Hi
Can you put an alert and check in the client script -
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var deliverydate = g_form.getValue('delivery_date'); //variable field
alert(deliverydate);
var ajax = new GlideAjax('AjaxDurCalc');
ajax.addParam('sysparm_name', 'durCalc');
ajax.addParam('sysparm_deliv', deliverydate);
ajax.getXML(setDate);
function setDate(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('actual_start_date', answer);
}
}
I've added an alert in the above script
Regards
Omkar Mone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2019 12:15 AM
Hi Omkar,
It is finally working now. Thank you for your help.
I am finally getting the actual start date in the catalog form.
Just one last step, can we add the schedule into it somehow? It is showing calendar days which includes Sat and Sun instead of business days?
Thanks