Currently, there is no validation for date fields in event records, allowing events to be created with a start date after the end date. This section shows how to use code generation to create a business rule preventing this
issue. While date validations can be time-consuming, Now Assist streamlines the process with code generation.
Before you begin
Role required: admin or delegated_developer
Procedure
-
From the We Volunteer app dashboard, select .
-
Enter Global in the Application field.
-
Under the Server Development category, select Business Rule.
-
Select Continue.
-
Add the following specifications to the new business rule:
- Name: Date validation
- Table: Event [x_snc_we_volunteer]
- Advanced: true (select the check box)
- When: before
- Insert: true (select the check box)
- Update: true (select the check box)
-
Select Add Filter Condition.
-
Add the following specifications to the filter condition:
- Starts: changes
- OR
- Ends: changes
-
On the Advanced tab, click into the third line in the script editor.
-
Open the Now Assist code generator by pressing Command + Enter (on Mac) or Ctrl + Enter (on Windows).
-
Enter the following text: Get value of start date(starts) & end date (ends) from the current record, using GlideDateTime() check if start date is greater than end date, abort if true, check if start date
is past due, abort if true.
-
Select the Submit icon (
) and wait a few moments for Now Assist to generate a code snippet.
-
Select Accept.
-
Select Submit.