- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2019 12:55 PM
Hello Expert 🙂
I have in my table two fields only , a) start date >> b) end date
I want to prevent user to select end date before start date using UI Policy , always Im searching about best practices , no need for coding here , i think there are Out of the box UI policy to do my goal
exmaple :
Start date : 2019 - 2 - 14
end date : 2019 - 2 - 12
here i want to prevent user to enter this invalid value for end date
thanks 🙂
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2019 02:36 PM
I was able to do this using a onChange client script (See screenshot). Only condition is that you are using date fields and not string fields.
Hope this helps!
-Joel R.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2019 02:20 PM
Generally, this is done in a client script, like this one:
/nav_to.do?uri=%2Fsys_script_client.do%3Fsys_id%3D0a6b13db672222004792adab9485ef0e%26sysparm_record_target%3Dsys_script_client%26sysparm_record_row%3D2%26sysparm_record_rows%3D31%26sysparm_record_list%3Dsys_class_name%253Dsys_script_client%255EtableSTARTSWITHchange%255EORDERBYorder
There is a method that is used in this script that will help you out. I wouldn't recreate the wheel by shoving this into a UI Policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2019 02:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2019 04:45 AM
i found out the below the hard way:
1) when you use g_form.getValue() in a client script the result is a variable of type STRING
2) so, if your date properties are set to yyyy - mm - dd the date comparison works because it is alphanumeric
if they are set to dd-mm-yyyy, for example, the comparison fails
