Hello Team,
I am adding Epic Schema Attribute “LAST_ACCS_DATETIME” in IIQ. The value I am getting for “LAST_ACCS_DATETIME” is like this : 6/26/2024 3:34:00PM
I want the value to be only 6/26/2024 .
I am created a customization rule
The error you’re encountering (java.lang.NumberFormatException) is because the value you’re passing (“7/15/2022 7:25:00AM”) is a string representing a date and time, not a number. In your script, you’re trying to parse this string into a long (Long.parseLong()), which expects a numeric value, not a date-time string.
To fix this, you should treat the LAST_ACCS_DATETIME as a string, parse it into a Date object using SimpleDateFormat, and then reformat it to only keep the date part.
Maybe you can do like this:
import sailpoint.object.ResourceObject;
import java.util.Date;
import java.text.SimpleDateFormat;
SimpleDateFormat iiqDateFormat = new SimpleDateFormat("MM/dd/yyyy");
SimpleDateFormat inputDateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ssa");
if (object.getAttribute("LAST_ACCS_DATETIME") != null) {
String LAST_ACCS_DATETIME = object.getAttribute("LAST_ACCS_DATETIME");
try {
// Parse the input string into a Date object using the input format
Date parsedDate = inputDateFormat.parse(LAST_ACCS_DATETIME);
// Format the parsed date into the desired output format
object.setAttribute("LAST_ACCS_DATETIME", iiqDateFormat.format(parsedDate));
} catch (Exception e) {
// Handle parsing error if the input string is not in the expected format
e.printStackTrace();
}
}
return object;
This should solve the issue, and you will get the LAST_ACCS_DATETIME in the MM/dd/yyyy format.