g_form.setValue is not setting value in Date/time field for Onsubmit client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 01:31 AM
Hi All,
I have created one date/time field 'Date' which is read only. I have written one client script to populate the field with current date and time. For it i have used script include which will return current time using gs.nowDateTime(). I am using this because i want the Date field should be populated even if i hit 'Save' button on form and no changes are done to other fields on form.
While saving it is showing that field is populated with current date time...but after record is saved and form is loaded..Date field is blank..
Please help me why it is happening like that...i want to save date field with date and time when i just hit 'save or update' button and make no changes to fields on form\
Thanks,
Nikhil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 03:37 AM
I tried but after hitting save form is getting hung and not proceding further

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 03:42 AM
Then remove g_form.save(); and try again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 04:28 AM
then also not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 08:21 AM
The example at https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=client shows that you need to unwrap the response using something like this in your callback function.
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 02:04 AM
What is the date field for?