Usecase:
This article outlines the steps for implementing a room booking feature using a custom module, Which blocks the dates if a room is already booked. The objective is to prevent double booking of rooms and provide feedback when attempting to book an already reserved room within the selected time range.
Requirement:
The application will display a message when attempting to book a room that is already reserved during the chosen time frame.
Steps to follow:
Step1:Navigate to Admin>>custom module>>Create new custom module>>Enter the details as in the below snapshot.
Step2:Under Form customizer>>Create four custom additional fields as in the below snapshot,namely:
- Date Fields: From , To
- Picklist Field: Room Name
- Single Line Field: Booked By
Step3:Under configurations>>Permissions can be modified as per requirement, sample attached below:
Step4: Goto Admin > Developer Space > Custom Module > Copy & Paste the content of attached roomBooking_CM.txt and save it with a name.
- Update the URL and technician key as per your instance.
- For the Integration key/Technician key
Step5: Goto Admin>>Global function>>copy paste the globalfunction content.txt and save it with a name.(Update the URL and technician key as per your instance).
Step6: Navigate to Admin>>Custom module business rule>>Configure the created custom function in a business rule to get executed for every new record being created for the custom module.
Now when attempting to book a room that is already reserved during the chosen time frame the application displays the below message.
Note:The field values should be same as in the screenshot for the script to work,If you change the value names then the same should be modified and updated in the script to work.