Restricting spaces to be reservable on certain weekdays

SC_gt
Tera Contributor

Is there a way to define that a space is only reservable on specific weekdays? For example, if a space is set as available on Monday and Wednesday, it will not show as available the rest of the week.

 

I know there is an option to create block location records, but is there a way to restrict it indefinitely?

5 REPLIES 5

Amit Gujarathi
Giga Sage
Giga Sage

HI @SC_gt ,
I trust you are doing great.
You can create Business rule with script something like this :

(function executeRule(current, previous /*null when async*/) {

    var reservationDay = new GlideDateTime(current.reservation_date);
    var dayOfWeek = reservationDay.getDayOfWeekUTC();

    // Monday is 1 and Wednesday is 3 in GlideDateTime
    if (dayOfWeek !== 1 && dayOfWeek !== 3) {
        var errorMessage = "This space can only be reserved on Monday and Wednesday.";
        current.setAbortAction(true);
        gs.addErrorMessage(errorMessage);
    }

})(current, previous);

 


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Thanks Amit. This looks good, but I would like the space to not be shown to the user on days it is not available. 

Michael Mooter
Tera Contributor

We are running into the same situation where our leadership team wants groups to only be able to reserve specific spaces on specific days of the week.

Community Alums
Not applicable

We have a similar requirement, certain desks are required for certain users due to OH&S. On the days those users are not in we want those desks to be available to book. 

Did anyone find a solution to this that doesn't require scripting? Surely there is some configuration ServiceNow have provided that accomplishes it. No?