- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2019 11:56 PM
Hi,
I've a requirement where in I need to compare a date with the record's created date and make sure it is not before/earlier than that.
For this, I'm using the "onChange" trigger set on the date field and I was wondering if it would be possible to get hold of the created date within the script?
One approach that I can think of is using GlideAjax to call a server script include and query the database by passing the "g_form.getUniqueValue()" value to the function. Then as a response, I can return the value back to the client. However, I was hoping if I can avoid going through all that for a single value.
Another approach is to use a "display" business rule to make use of "g_scratchpad" and send that value to the client. But again, this will involve the use of an additional business rule.
Any other alternatives/suggestions?
PS: The "Created" date is not present on the form and I do not have permissions to change the form layout.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2019 12:25 AM
HI,
If you want to use client script then its mandatory that it should be on form. But now in this case its not on form.
So we are left with either BR or GlideAjax.
So pleaase use them and its a recommended best practice.
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2019 12:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2019 12:18 AM
The created field is not available on the form and I do not have the permissions to add it. So I don't think getValue() will work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2019 12:15 AM
if you want the sys_created_on of the same record, then you can get the value directly in client script using getValue().
Do make sure the variable is available in the form with the help of form-layout.
To compare the dates, this thread might be helpful - https://community.servicenow.com/community?id=community_question&sys_id=624f3e69db58dbc01dcaf3231f96...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2019 12:18 AM
The created field is not available on the form and I do not have the permissions to add it. So I don't think getValue() will work.