
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
08-06-2019 08:20 AM - edited 07-21-2024 01:15 AM
Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
Hi there,
Client Side date validations, o man, they can be a real pain in the but! Getting the right format, different language settings, timezones, etc.. And then working with Scoped Apps… some GlideDate functions not being available. If you look at the community posts, a lot of situations like these are posted. Scripting not working, applying GlideAjax, splitting dates, etc.. So to share some gained knowledge and experience:
There's a much easier way!
Using the No Code condition builder on (Catalog) UI Policies! Only Low Code needed for an info/error message to display to the user, maybe clearing the field/variable value, etc..
Examples
How to setup checking if…
An entered date for a Variable is in the past. If so, clear the variable value and give the User an error message.
An entered date for a Field is after 7 days in the future. If so, clear the field value and give the User a field message.
Comparing two entered dates with each other. Date 2 should not be before Date 1 (image, planned end date should not be before planned start date)
As you can see in the examples above, Low Code for the follow-up on your validation and the actual validating simply through the condition builder within a (Catalog) UI Policy.
---
And that's it actually. Not much to it. Hope you like it. If any questions or remarks, let me know!
C |
If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.
Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in? |
Kind regards,
Mark Roethof
ServiceNow Technical Consultant @ Paphos Group
---
- 75,686 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
how to do it with the client script

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@MalikB if you search a little bit on the Community, you will see that question has been answered hundreds of times.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello @Mark Roethof
Thank you for this solution. I have the exact same requirement.
If start date and end dates are less than 180 days apart, I should hide an option from another select box variable on the form.
I am using Catalog UI policy conditions and the Catalog UI policy script( g_form.removeOption() ) to achieve this. This UI policy does not contain any actions.
May I know pros and cons of this approach over a client script (GlideAjax, script include etc etc)?
Is this approach better than client script considering best practices, system performance etc?
Many Thanks In Advance
Manthan
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
ServiceNow Workspace has really made it so hard to do anything. This does not work on CSM workspace at all... Absolute pain in the neck.
- « Previous
-
- 1
- 2
- Next »