How to write a client script to hide fields from form if created after today date serviceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2022 08:07 AM
Hi All,
I want to hide field from for if created after today how to write a client script for this?
Thanks in Advance,
Prachi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2022 11:56 PM
Does "today" imply a fixed date such as "March 21, 2022" of or "today" as when the form is opened?
If it's the time when the form is opened and field "Created" is of type Date, set the condition to "Created" "after" "today" as I've done in my earlier response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2022 12:20 AM
Hi Prachi,
Don't select the calendar icon. Select the "v" drop-down and select "Today".
The condition should be "Created", "before", "Today" because "Created" will be the date when the record was created. That is, if today's date if after the date when the record was created, then hide the field.
Note, that field "Created" is automatically set by ServiceNow to the date when the record is created. As such, it's not possible to "create" a record in the future date.
Execution results:
case 1: record created today. Field "Field to hide" is visible.
case 2: record created in the pase. Field "Field is hide" is not displayed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2022 10:09 PM
"but its not working"
So what's not working? You are not sharing anything or asking for help on what's not working?
Anyway, here you go, proven mechanism:
- 2019-08-12 No Code date validations thru (Catalog) UI Policies
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2022 08:17 AM
This can be achieved by UI policy as well:
Condition can be:
Created - after - today
Add ui policy action for the field
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2022 09:15 PM
Hi there,
Any follow-up needed? Or was my answer sufficient?
Let me know.
If your question is solved, please close the topic by marking my answer as correct. This will help others searching for a similar question and will remove the topic from the unsolved list.
Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field