We are on IIQ 8.3
I need to display the date that an AD Account Password will expire in one of our Workflow Emails. I thought to add a Process Variable of type ‘Rule’ to the Workflow and then pass that variable to the Send Email step and use it in the Template.
I’m trying to take the pwdLastSet AD value and adding 90 days to it and then return that date to be used in the EmailTemplate.
Can someone look over what I’m doing and tell me what is wrong or just that I’m perhaps doing it completely wrong?!!?
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.TimeUnit;
Identity iden = context.getObjectByName(Identity.class, identityName);
List<Link> listAccounts = iden.getLinks();
if(null!=listAccounts) {
for(Link account : listAccounts) {
appName = account.getApplicationName();
accountName = account.getDisplayName();
if(appName.equalsIgnoreCase("CORP AD")){
String empType = link.getAttribute("employeeType");
if (empType.equalsIgnoreCase("Employee"){
String pwdLastSet = link.getAttribute("pwdLastSet");
long ninetyDaysInMillis = TimeUnit.DAYS.toMillis(90);
long newTimeInMillis = ((pwdLastSet / 10000) - 11644473600000L) + ninetyDaysInMillis;
LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(newTimeInMillis), ZoneId.systemDefault());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDate = dateTime.format(formatter);
return formattedDate;
}
}
}
}
Error -
sailpoint.tools.GeneralException: Exception evaluating rule: CORP Find PWD Expiry
sailpoint.tools.GeneralException: BeanShell script error: bsh.ParseException: Parse error at line 20, column 104. Encountered: ; BSF info: YSI Find PWD Expiry at line: 0 column: columnNo
Thanks for any assistance!!