Get lastLogonTimestamp AD attributes in Sailpoint IIQ

Which IIQ version are you inquiring about?

Version 8.1

Please share any images or screenshots, if relevant.

image.png

Share all details related to your problem, including any error messages you may have received.

Hello Team,
I added the lastLogonTimestamp AD Attribute in IIQ. But it displays like a long integer (I have attached the screenshot). How can I convert this long inter into a proper Date Format?
Any suggestion will be helpful.

@j1241 ,

You can use below logic in Customization rule to get the value in your desired format.

import sailpoint.object.ResourceObject;
import java.util.Date;

SimpleDateFormat iiqDateFormat = new SimpleDateFormat("dd-MMM-yyyy");

if(object.getAttribute("lastLogonTimestamp") != null){
  long lastLogonTimestamp = Long.parseLong(object.getAttribute("lastLogonTimestamp"));
  Long mills = (lastLogonTimestamp / 10000000);
  long unix = (((1970 - 1601) * 365) - 3 + Math.round((1970 - 1601) / 4)) * 86400L;
  long timeStamp = mills - unix;
  Date date = new Date(timeStamp * 1000L);
  object.setAttribute("lastLogonTimestamp", iiqDateFormat.format(date));

}
    
return object;

Hi and hello,

import java.util.Date;

public class ADDateConverter {

public static Date convertADTimestamp(long timestamp) {

    long epochStart = -11644473600000L; // Difference in milliseconds between 1601 and 1970
    return new Date(epochStart + (timestamp / 10000));
}

public static void main(String[] args) {

    long timestamp = 133367543678908765L;
    Date convertedDate = 
    convertADTimestamp(timestamp);
    System.out.println(convertedDate);
}

}

Regards,

Adam

3 Likes

Thank youboth @AdamVentum and @Shandeep for your instant response.
Would it be ideal if i made theses changes in correlation rule?

No, correlation rule is not ideal, rather you should use customization rule for this conversion.

1 Like

One hint from me - you have to be carefull as this attribute does not sync across domain controllers. That means you might not always have correct data by aggregating it.

3 Likes

Also one suggestion from my side its better to have both lastLogonTimestamp and lastLogon attribute in SailPoint from AD aggregation for computing any dormancy use case.

Meanwhile Mr @Shandeep has already provided the code sample that you can use in your customization rule :grinning:

1 Like

One suggestion from my side , Don’t covert this as part of the customization rule , this rule will get called for each and every account during aggregation which can degrade the performance .

better if you have to show this value somewhere or use this somewhere , let it be in long value in link object and change this were ever you use this one to the required format .

Happy Learning !

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.