Account expiry dates

andrewnorris
Giga Contributor

Hello

We currently import our users from active directory to SNC via the LDAP plugin. I want to bring over the account expiry dates too but as this is stored in Integer8 format it will need some transform scripting to get it to show a human-readable date format.

I'm afraid I have no idea how to convert Integer* to the current date format. Can anyone offer help or guidance?

Thanks
Andy

33 REPLIES 33

If you're not running the Fall release, you will need the script to be an onBefore transform (it will work even if you are).

I believe in the Fall release there is a "Use source script" mapping option. I have not yet used it, however, so I can't speak to the syntax.

The field type should be date-time.

An easy way to debug is to do something like this:
gs.log('User transform integer date conv: ' + target.u_account_expires);
then look in the system logs for that line.


cdeclos
Mega Contributor

Hello Folks

I've put the script as it is in the 'use source script' window for the appropriate transform field, created the 'onbefore' transform script, not forgotten to rename the fields in the transform script the same as in my tables and it almost worked like a charm !

Almost, because for some strange reason, on most of the nonexpiring accounts, the accountexpires parameter is returning a date of 01-01-1601 when transformed ... Funny, isn't it ? I'm now working adapting the script to exclude those values. Once done, I'll post it here.

Christian
Service Desk Manager
Ion Beam Applications sa


Not applicable

Christian,

99.9% of the accounts in our domains don't have expiration dates, so I am experiencing similar behavior. I left the field as 'YYYY-MM-DD HH:MM' so 99% of the accounts are transforming to '1600-12-31 09:00' (or some other time). While easy to filter this particular value out, it's distracting. Did you happen to get anywhere with excluding that value?


cdeclos
Mega Contributor

Hello

Unfortunately, as this was not a major issue to us, I gave up trying...
However, I can imagine that you might want to create a cleanup script that would set all '1600' dates to nothing while doing the AD imports, but I'm everything but a scripting king 😉

Cheers,

Christian


This is awesome. Thank you for sharing. Recently got a feature request to fire notifications to managers of users with expiring accounts because the way our Ops team was doing this in-house was not working reliably. Figuring out how to convert the string from AD to a date was what was making me put it off. You got me motivated. 🙂