- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2020 03:45 AM
Hi Team,
I am trying to update employee end in user table from AD (accountExpires) . AD date value coming like "132590304000000000" this format So, I have converted this to date format using below script .
Issue is updating one day ahead for few users
Ex: user has employee end date of 2021-02-28 where the AD account is set to expire on 2021-02-27.
function getLocalTimeZoneDateTime(dateTimeUTC) {
var gdt = new GlideDateTime(dateTimeUTC);
gs.log("Date " + gdt);
return gdt.getDisplayValueInternal();
}
var dtUtil = new DateTimeUtils();
if (source.u_accountexpires === undefined) {
// set a blank value if the source is 'undefined'
target.setValue("u_employee_end_date",'');
} else if (source.u_accountexpires != 0) {
gs.log("source date" + source.u_userprincipalname + " :" + source.u_accountexpires);
// convert the date from int8 format to GlideDateTime in UTC
var expiresUTC = dtUtil.int8ToGlideDateTime(source.u_accountexpires);
// convert the GlideDateTime in UTC to Local TimeZone
var expiresLocal = getLocalTimeZoneDateTime(expiresUTC);
gs.log("Target date " +source.u_userprincipalname + " : " + expiresLocal);
//log.info("ExpiresLocal: " + expiresLocal);
// Set the value to the Local Time Zone value
//target.setValue("u_employee_end_date", expiresLocal);
} else {
// set a blank value if the source is anything else.
target.setValue("u_employee_end_date", '');
}
Thanks,
Khasim
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2021 02:41 AM
I have fixed this issue with below article
The article also talks about the calculation issues with this being a day off
http://www.rlmueller.net/AccountExpires.htm
Thanks,
Khasim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2021 02:41 AM
I have fixed this issue with below article
The article also talks about the calculation issues with this being a day off
http://www.rlmueller.net/AccountExpires.htm
Thanks,
Khasim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2021 02:07 PM
Hi Khasim,
Could you please let me know how did you solve this issue through scripting? Even I am looking to convert this 18digit value to date and import into User table field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 11:40 AM
Hey, I'm learning SN and I'm a rookie
can u please help me in understanding LDAP v/s SSO ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 01:29 PM
@RaiPalash LDAP is used for creating user records and groups in Servicenow.
Administrators integrate with a Lightweight Directory Access Protocol LDAP directory to streamline the user login process and to automate administrative tasks such as creating users and assigning them roles. An LDAP integration allows the system to use your existing LDAP server as the primary source of user data.
LDAP authenticationUse LDAP authentication to access using LDAP credentials.
- The instance passes the credentials to an LDAP server to find the instance.
- With RDNs, it validates the user's DN string. It validates only if at least one of the LDAP OU configurations has an RDN configured.
- The LDAP server responds with an authorized or unauthorized message that the system uses to determine whether access should be granted.
By authenticating against your LDAP server, users access the platform with the same credentials that they use for other internal resources on your network domain. Also, you can reuse any existing password and security policies that are already in place. For example, the LDAP server may already have account lockout and password expiration policies.
SSO:
External SSO allows organizations to use several SSO identity providers (IdPs) to manage authentication as well as retain local database (basic) authentication. Example : OKTA.
Please mark helpful and accept solution if you have got the clarity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 10:50 AM
Thanks for the help