- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2022 03:17 AM
The date field should not allow users to fill less than 24 hrs from the current date and it should follow a defined schedule
For example Schedule: Mon-Fri (8:00-19:00)Business hours
it should throw an error if the date is less than 24 hrs or out of business hours.
Looking for help.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 08:54 PM
Hi,
is script include client callable?
is the function being called properly?
share logs for this
var ajaxDateDiff = Class.create();
ajaxDateDiff.prototype = Object.extendsObject(AbstractAjaxProcessor, {
check5Days: function () {
var answer;
var valid = new GlideDateTime();
valid.setDisplayValue(this.getParameter('sysparm_date'));
gs.info('User value->' + valid);
var schedule = new GlideSchedule('377f5e51db2e851040d8176a489619cc');
var inSchedule = schedule.isInSchedule(valid);
gs.info("Is in schedule->" + inSchedule);
if (!inSchedule)
{
answer = 'false';
}
else
{
answer = 'true';
}
return answer;
},
});
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2022 03:23 AM
Hi,
you can use onChange client script and GlideAjax and use schedule calculation in script include
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2022 03:34 AM
Cloud you please help me with the script.
I was confused about where to use the schedule in my script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2022 03:42 AM
you would require to use schedule for this
below links should be helpful
https://community.servicenow.com/community?id=community_blog&sys_id=314e26addbd0dbc01dcaf3231f961986
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2022 04:35 AM
Unable to find a required answer.