- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 05:26 AM
Any solutions I could find on the internet have not worked.
I only get strange behavior and have to delete the variable and create again.
We have a date field on a catalog item.
The default date should be 4 business days in the future.
If anyone is currently doing this, please help.
We only use the portal UI.
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 11:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 10:45 AM
Use onLoad Client script with GlideAjax or did you try in default value?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 10:51 AM
Use the below script in defualt value on variable form
javascript:var gdt = new GlideDateTime();
var dc = new DurationCalculator();
dc.setSchedule('08fcd0830a0a0b2600079f56b1adb9ae'); // Schedule sys_id
dc.setStartDateTime(gdt);
dc.calcDuration(4*9*3600); // 8-5 Schedule so 9 Hrs
var edt= new GlideDateTime(dc.getEndDateTime())
edt.getDate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 10:52 AM
Ok. I was just saying I can try that. Stand by. Fingers Crossed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 10:57 AM
Ok dvp,
I'm getting a value returned to the Date field. But the format is bad, so I can't tell what date its returned.
03-02-0172
The same thing happens if I just use
javascript:addDays(4);
in the default field. I needed to use
javascript:var d = new GlideDateTime(); d.setValue(gs.daysAgo(-5)); d.getDisplayValue();
so the date format would display correctly.
Can I manipulate your javascript in a similar way so the date is formatted correctly?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 11:01 AM
did you try replacing
edt.getDate();
with
edt.getDisplayValue();