Booking Rules

 

Universal Resource Scheduling (URS) includes a great feature to extend the Schedule Board functionality to apply specific custom logic and alert Dispatchers when they create or update a Bookable Resource Booking records.  This feature is known as Booking Rules.  Booking Rules are not to be confused with Booking Alerts.  Booking Alerts has a different purpose and we can discuss this in another article.

Out-of-the-box, URS provides effective ways to filter resource requirements, resources, and efficiently book Work Orders (or any schedulable entity) to a suitable resource.  In certain scenarios, we need to apply additional logic before creating or updating a Booking (aka Bookable Resource Booking entity).

Example Scenarios:

Display a warning to the dispatcher if he/she attempts to assign a Work Order to a Resource who is not one of the Preferred Resources defined using the Requirement Resource Preference related to the Work Order.

Display a warning to the dispatcher if he/she attempts to assign a Work Order to a timeslot outside the Time Promised From/To range.

Display an error to the dispatcher if he/she attempts to assign a Work Order to a Resource who is defined as Restricted defined using the Requirement Resource Preference, with Preference Type = Restricted, related to the Work Order.

Display an error to the dispatcher if he/she attempts to update an existing Booking by dragging and dropping onto another Resource and the new Resource is already assigned to another Work Order in the same timeslot.

You can think of many scenarios where Booking Rules can be used to apply business logic when creating and/or updating Bookings.

Notification Types

There are two different types of notifications.

  • Error – Displays a message and cancels the transaction.

Rule - Error

  • Warning – Displays a message and allows the user to cancel or continue with the transaction.

Rule - Warning

To define the Notification Type, set the ruleResult.Type to ‘error’ or ‘warning’.

How to Trigger a Booking Rule

There’s an excellent article in docs.microsoft.com which describes how to create a Booking Rule – Set up booking rules.  In this generic example, a custom action is triggered by the JavaScript code.  The Custom Action is a configuration feature which allows a Functional Consultant to extend the functionality without a Developer.  I highly recommend reviewing this article.

For a more simple explanation please see below.

Step 1 – Create a JavaScript Web Resource.

Example:

Step 2 – Create a Booking Rule Record

  • Select the JavaScript Web Resource
  • Specify the function name

That’s it.  Now, whenever a Bookable Resource Booking record is created or updated through the schedule board or from the Bookable Resource Booking form, JavaScript function will trigger.

Booking Rules - Results

References

Docs – Set up Booking Rules – https://docs.microsoft.com/en-us/dynamics365/customer-engagement/field-service/set-up-booking-rules

Docs – Booking Alerts – https://docs.microsoft.com/en-us/dynamics365/field-service/booking-alert

Credit – Header Image – https://www.pinterest.com.au/pin/313774299016874614/

Thank you for visiting Dyn365Apps.com.

Follow me on Twitter – 

Until next time…

About the Author

Nadeeja Bomiriya is a Microsoft MVP, Chapter Lead – Dynamics 365 and Power Platform Saturday – Australia, Sri Lanka, Committee Member – Melbourne Dynamics 365 User Group, Technical Architect, and Dynamics 365 Practice Lead who lives in Melbourne, Australia.

Disclaimer: This blog post contains opinions of my own and not the views of my employer.

Extending URS Schedule Board – Booking Rules