We will now create a business rule that will execute before the insert operation and that will abort the operation when there is another request currently in a pending or open state that is made by the same caller. It will execute a script that will query the Booking Request table using the GlideRecord for the presence of another pending or open request by the same caller.
Let us now switch to Studio and open the business rule new record form by selecting Server Development | Business Rules in the Create Application File wizard.
Fill in the form with the following details:
- Name: Booking request by same caller
- Table: Booking Request
- Active: Checked
- Advanced: Checked
- When: before
- Order: 80