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

Hi bteacher,

I've tried your solution here, but I get this Warning;

org.mozilla.javascript.EcmaError: Cannot read property "u_account_expires" from null
Caused by error in sys_transform_script.929e9bab1bd4e410f94c7739cd4bcbe0.script at line 16

13: gs.log('Setting the Account Expires date for ' + target.name + ' to ' + gDate);
14: }
15: // Clear the SN Account Expires date if the accountExpires date is no longer set in AD
==> 16: else if (!target.u_account_expires.nil()) {
17: target.u_account_expires = '';
18: gs.log('Updating the SN Account Expires date for ' + target.name + ' to Never');
19: }

 

Any idea of why? Or does anyone else know why I get this Warning when I use this solution? I still do get the values (large integer witch starts with 13), but this doesn't populate to field Account Expires. 

 

Best regards,
Adrian 

etobia
Kilo Expert

Hello All,



Has anyone figured out regarding the issue where the expiry date in the user table is displaying 1 day ahead of the actual account expiration in AD? I have tried all the recommended fix in this thread but with no avail.



Thanks in advance.



Edwin


a_necho
Giga Contributor

var gDate = source.u_accountexpires - 864000000000;


var dtUtil = new DateTimeUtils();


target.u_account_expires = dtUtil.int8ToGlideDateTime(gDate);


AdrianHolm
Tera Guru

Copy from reply further up in this post:

Hi bteacher,

I've tried your solution here, but I get this Warning;

org.mozilla.javascript.EcmaError: Cannot read property "u_account_expires" from null
Caused by error in sys_transform_script.929e9bab1bd4e410f94c7739cd4bcbe0.script at line 16

13: gs.log('Setting the Account Expires date for ' + target.name + ' to ' + gDate);
14: }
15: // Clear the SN Account Expires date if the accountExpires date is no longer set in AD
==> 16: else if (!target.u_account_expires.nil()) {
17: target.u_account_expires = '';
18: gs.log('Updating the SN Account Expires date for ' + target.name + ' to Never');
19: }

 

Any idea of why? Or does anyone else know why I get this Warning when I use this solution? I still do get the values (large integer witch starts with 13), but this doesn't populate to field Account Expires. 

 

Best regards,
Adrian