Add time limit on Expected delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 08:50 PM
Requirement:
Add time limit for expected delivery based on user's selection of drop-down[Delivery Type: Normal Delivery - 5 days, Express Delivery - 3 days, Express Delivery - 2 days and Express Delivery - 1 day].
In form we have below 2 variables,
1. Delivery Type[Select Box] - In this we have 4 options[Normal Delivery - 5 days, Express Delivery - 3 days, Express Delivery - 2 days and Express Delivery - 1 day].
2. Express delivery[Date/Time].
So here, when we select "Delivery Type" the "Expected delivery" field will auto-populate the date/time.
For example:
User/Me trying to submit the request on 19/06/2025 and the user/me select the "Delivery Type: Normal Delivery - 5 days", in "Expected delivery - we need to auto-populate the date/time is 25/06/2025".
Note: The Expected delivery will populate based on "Delivery Type", if it 5days,3days,2days and 1day - means we need to calculate the date - based on user's[means Singapore user's] selection from date of ticket submission, and in this we need to exclude Singapore public holidays, Saturdays and Sundays and if public holiday falls on weekends, then the following "Monday" is off day.
Thanks,
Jyothi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 11:11 PM
_isBusinessDayWithHolidaySchedule: function(date, schedule) {
// Check weekend (Sunday = 1, Saturday = 7)
var dayOfWeek = date.getDayOfWeekUTC(); if (dayOfWeek === 1 || dayOfWeek === 7) { return false; } // Check if date is in the Singapore Holidays schedule // If the schedule contains this date, it's a holiday (not a business day) var checkDateTime = new GlideDateTime(date); checkDateTime.setDisplayValue(date.getDisplayValue().split(' ')[0] + ' 10:00:00'); // If the date is in the holiday schedule, it's NOT a business day var isHoliday = schedule.isInSchedule(checkDateTime); return !isHoliday; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2025 02:03 AM
Hi @venkat917181,
I have written code but in this the "Expected delivery" date is auto populating based on "Delivery Type", but in this we need to populate the "Expected delivery" based on Singapore time zone, for example if I submit the request before 3pm Singapore time we need to calculate on 26-06-2025 to 2-06-2025 5 days the delivery type is "Normal Delivery - 5 days", so we need auto populate 02-06-2025, if we submit the request after 3pm we need to consider next business day which means 27-06-2025 to 03-07-2025, we need to populate in expected delivery 03-07-2025, how to add this timing before 3pm and after 3pm Singapore time in my script include and catalog client script. In the below image,
Normal Delivery - 5days - if we submit request before 3pm Singapore time, should calculate/count same day, if we submit request after 3pm Singapore time, should calculate/count next business day,
Express Delivery - 3 days, 2 days and 1 day.
Script Include:
Catalog client script:
Thanks,
Jyothi
