
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 01:55 AM
I have configured ServiceNow to query and fetch User and Generic Accounts. However two fields which are flowing from MS Active Directory namely 'Password Last Set' and 'Last Logon' seems to be in completely different format other than date and time.
I have tried the following script but it does not seem to work.
====================================
answer = (function transformEntry(source) {
var gdt = new GlideDateTime();
var s = source.u_pwdlastset;
gdt.setNumericValue((mstime - 116444736000000000)/10000);
var lastset = gdt.getValue();
return lastset;
})(source);
==================================
Also I have tried the solution provided in the below article, which does not seems work at all.
https://community.servicenow.com/community?id=community_question&sys_id=c5ba0f2ddb5cdbc01dcaf3231f9619f3&view_source=searchResult
I would appreciate if you could review this in detail and help me with your expertise.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2018 11:36 PM
Here is the solution:
answer = (function transformEntry(source) {
var gdt = new GlideDateTime();
var mstime = parseInt(source.u_pwdlastset);
gdt.setNumericValue((mstime - 116444736000000000)/10000);
log.info(gdt.getValue()+'date');
return gdt.getValue(); // return the value to be put into the target field
})(source);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2018 11:36 PM
Here is the solution:
answer = (function transformEntry(source) {
var gdt = new GlideDateTime();
var mstime = parseInt(source.u_pwdlastset);
gdt.setNumericValue((mstime - 116444736000000000)/10000);
log.info(gdt.getValue()+'date');
return gdt.getValue(); // return the value to be put into the target field
})(source);