- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 08:56 AM
I want to fill out date fields automatically, when a form is loaded. Very straightforward, but now it seems I can't call gs.nowDateTime client-side. I have read through the API, but can't seem to find the client-side equivalent. Is there no equivalent, because I shouldn't be doing something like this through client scripts? Or did SN just forget about it, which I doubt.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 10:07 AM
Hi Peter,
Please go through the following link hopefully that will help you.
Client Script Date/Time Functions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 09:02 AM
Have you tried the Javascript default date object?
var dt = new Date();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 09:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 09:14 AM
Hi Peter,
I'd suggest using an AJAX script include to expose calls to server side functions. That should give you access to the power of the gs DateTime functions and all the user timezone functionality which ServiceNow has already provided
Kind regards,
Simon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2016 11:51 AM
I tried that, but my ajax request didn't return as you can see in my other reply to Mayur Tejnani.
Edit: It works now, thanks!