- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 01:45 AM
Hi SN community,
I have a UI macro that is invoked when a particular button is pressed. When this happens, I send some data to a webserver, and one of these data poubts is the current time and date according to the servicenow instance, I have tried to do it the following way:
data["==unixtime_ms=="] = "${new GlideDateTime().getNumericValue()}";
however, it seems the expression is only evaluated when I update the UI macro, and not OnClick as I want. How do I crate a new GlideDateTime object on each onclick event in a UI macro? Help much appreciated!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 03:40 AM
Hi
it seems you have done something wrong while creating script include.
Create a new one with client callable tick and do this.
and check if this script include is for all application scopes i.e Global.
var getdate = Class.create();
getdate.prototype = Object.extendsObject(AbstractAjaxProcessor, {
type: 'getdate'
});
This type of Script include is created when client callable is true.
Mark Correct if it helps.
Warm Regards,
Omkar Mone
www.dxsherpa.com

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 03:41 AM
can you put the log also remove the initialize
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 04:40 AM
Hi both, I got it working. Either my initialize function messed it up or something was wrong with how the script was set up. Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 04:42 AM
glad it worked.
Please mark the answer correct and close this thread.