Hi @AroraA3 and @iamksatish,
I made the following changes and acctually link.getLastTargetAggregation() is coming back as null;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import java.text.SimpleDateFormat;
import java.util.Date;
Log serilog = LogFactory.getLog("sailpoint.LastTargetAggregationScript");
serilog.debug("Starting script.");
try {
if (link != null) {
serilog.debug("Link object is not null.");
if (link.getLastTargetAggregation() != null) {
serilog.debug("LastTargetAggregation is not null.");
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
String formattedDate = formatter.format(link.getLastTargetAggregation());
serilog.debug("Formatted date: " + formattedDate);
return formattedDate;
} else {
serilog.debug("LastTargetAggregation is null.");
return null;
}
} else {
serilog.debug("Link object is null.");
return null;
}
} catch (Exception e) {
serilog.error("An error occurred: ", e);
return null;
}
Can I know why the last aggregation date is null shouldn’t it return back the date of the last aggregation where the link was there?