How to get account expires field form AD to user table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 10:34 PM
Hello All,
I am unable to resolve this since few days,
I want to calculate when an users account will expires, Coming from AD.
I want a script to calculate when users account will expire and Map it in sys_user table field 'u_acc_expire'.
need some assistance.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 02:53 AM
Are you trying to fetch Expiry date from Active directory and update a field in user account in ServiceNow? If yes, please provide the format of expiry date from AD?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 10:30 PM
Hello @Swapna Abburi
Thanks for your response.
Yes I am trying to fetch AccountExpires Date from AD to sys_user table field which is in Date/time 'account expires'
Regards,
Ruchi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2022 07:28 AM
If the date and time format from AD is ""202212072308Z", then you may use below script to in transform field map source script.
var s = source.<field_name>;
var dt = s.substring(0,4)+'-'+s.substring(4,6)+'-'+s.substring(6,8)+' '+s.substring(8,10)+':'+s.substring(10,12);
return new GlideDateTime(dt);