Skip to content

Commit 610ac81

Browse files
authored
Update README.md
Changes to the file: 1. Use case description given. 2. One more example related to another part of the use-case added
1 parent e1645e1 commit 610ac81

File tree

1 file changed

+10
-2
lines changed
  • Client-Side Components/Catalog Client Script/Return Date Validation

1 file changed

+10
-2
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
This piece of code runs in an OnChange catalog client script for the field 'u_return_date' and validates the return date(u_return_date) in a ServiceNow Catalog item form to ensure:
1+
This piece of code was written as a part of an usecase where the return date value validation was expected to be after start date as well as within 6 months from the start date. This code runs in an OnChange catalog client script for the field 'u_return_date' and validates the return date(u_return_date) in a ServiceNow Catalog item form to ensure:
22

33
1. A start date(u_start_date) is entered before setting a return date(u_return_date).
44
2. The return date is within 6 months after the start date.
5-
3. Return date is not the start date or before that.
5+
3. Return date must be after the start date, it can't be same as it or before it.
66

77
Let’s say with an example:
88

9+
a)
910
u_start_date = 2025-10-01
1011
You enter u_return_date = 2026-04-15
1112

1213
Steps:
1314
a)Difference = 196 days → More than 180 days
1415
b)Result: u_return_date is cleared and error shown: “Select Return Date within 6 months from Start Date”
1516

17+
b)
18+
u_start_date = 2025-10-02
19+
You enter u_return_date = 2025-10-01
20+
21+
Steps:
22+
a)Difference = -1 day → Return date put as 1 day before start date
23+
b)Result: u_return_date is cleared and error shown: “Select Return Date in future than Start Date”

0 commit comments

Comments
 (0)