
- 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-04-2018 02:04 AM
Hi Abdul,
What values are coming in target once you use that script?
Are they not looking same as LDAP?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 02:52 AM
Its is giving a numerical value like "131876208004375493" - as per MSDN website, here is the formal definition "The date and time that the password for this account was last changed. This value is stored as a large integer that represents the number of 100 nanosecond intervals since January 1, 1601 (UTC)."
And I have also found a stackoverflow article, but struggling to make this work in ServiceNow.
https://stackoverflow.com/questions/52260811/active-directory-lastlogontimestamp-convert-integer-to-date
Any help would be appreciated!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 05:00 AM
Its is giving a numerical value like "131876208004375493" - as per MSDN website, here is the formal definition "The date and time that the password for this account was last changed. This value is stored as a large integer that represents the number of 100 nanosecond intervals since January 1, 1601 (UTC)."
And I have also found a stackoverflow article, but struggling to make this work in ServiceNow.
https://stackoverflow.com/questions/52260811/active-directory-lastlogontimestamp-convert-integer-to-date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 05:21 AM
Hi Abdul,
Can you check below links:
1st link should help you resolve
https://community.servicenow.com/community?id=community_blog&sys_id=6c9ceae1dbd0dbc01dcaf3231f961931
https://community.servicenow.com/community?id=community_question&sys_id=56315fe9dbdcdbc01dcaf3231f9619a7
https://community.servicenow.com/community?id=community_question&sys_id=c616cb61db1cdbc01dcaf3231f9619b9
What value does this variable hold?
mstime
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader