- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2014 07:28 AM
Hi All,
I'm trying to populate a read only field with today's date in the format of "28-May-2014" but notice that i cannot use any .gs functions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2014 08:13 AM
Hi Alex,
You refer to the below wiki link.
Set Current DateTime In Field - ServiceNow Wiki
Thanks,
Avneet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2014 08:13 AM
Hi Alex,
You refer to the below wiki link.
Set Current DateTime In Field - ServiceNow Wiki
Thanks,
Avneet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017 11:38 AM
The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here: Date and Time Fields
Visit http://docs.servicenow.com for the latest product documentation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2018 08:05 AM
So, the wiki is sadly dead (despite still being the best source for SN answers, while I've had about a 7% success rate getting anything out of docs), and I appreciate you trying to link to docs to find the answer there. But your "Date and Time Fields" link returns an error, and I cannot find whatever you're trying to point to via the docs search.
Docs means well, but man is it frustrating to use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2014 08:13 AM
Here is the script include, it needs to be client callable.
var MyDayAjax = Class.create();
MyDayAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
MyDayDate: function() {
return gs.now();
}
});
and here is the client script
var ajax = new GlideAjax('MyDateTimeAjax');
ajax.addParam('sysparm_name','nowDateTime');
ajax.getXML(SetValues);
function SetValues(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('u_date_sent',answer);
}
u_date_sent is the field that I was setting the date for.