locked
A sliding service outage windows for scheduling appointments that tracks current time RRS feed

  • Question

  • We have a business rule that appointments must not be scheduled less than 4 hours in advance. If worst comes to worst, I'll add javascript that validates appointment times and complains to the user/doesn't let you proceed if the time is less than 4 hours away. However, ideally whenever scheduling an appointment, the next 4 hours should not show up as available time at all. Is this possible?
    Friday, June 14, 2013 11:09 PM

Answers

  • Hi,

    Instead of manipulating the available times, you could use a JavaScript on the save of the form, in which you could compare the time of the appointment and the current time. If the difference is less than 4 hours, you could clear the date field and five alert. A simple code be as:

    function appointmentdate() {
    var currentdate = new Date();
    var appointmentdate = Xrm.Page.getAttribute("scheduleddate").getValue();
    if(appointmentdate - currentdate < 4 * 60 * 60) {
          alert("error");
          Xrm.Page.getAttribute("scheduleddate").setValue();
          }
    }



    My Weblog | My Website

    Saturday, June 15, 2013 3:34 PM
    Moderator

All replies

  • Hi,

    Instead of manipulating the available times, you could use a JavaScript on the save of the form, in which you could compare the time of the appointment and the current time. If the difference is less than 4 hours, you could clear the date field and five alert. A simple code be as:

    function appointmentdate() {
    var currentdate = new Date();
    var appointmentdate = Xrm.Page.getAttribute("scheduleddate").getValue();
    if(appointmentdate - currentdate < 4 * 60 * 60) {
          alert("error");
          Xrm.Page.getAttribute("scheduleddate").setValue();
          }
    }



    My Weblog | My Website

    Saturday, June 15, 2013 3:34 PM
    Moderator
  • Hi Payman,

    Thank you for the suggestions, but as I said I've already considered that solution and will implement it if worst comes to worst. However, it forces the user to manually inspect the suggested appointment times and check whether or not the time is within 4 hours before they pick it. This can be a pretty significant overhead for our phone team that spends most of the day scheduling appointments. If they make a mistake it won't let them proceed, but it doesn't make their manual process of selecting the time any easier.

    Monday, June 17, 2013 3:53 PM