Workitem AutoApproval After Sending Reminders

Hi,

Could someone please help on the below with sample code,

Need to Auto Approve the Workitem after sending the reminders.

Using below logic, to send the reminders, working good. But after sending all those reminders, need to auto approve the workitem.

// First Reminder

ReminderConfig firstReminderConfig = new ReminderConfig();
firstReminderConfig.setEnabled(true);
int days = differenceOfDays - 21;
System.out.println("days value is ----->"+days);
long milliValue = days * 24L * 60 * 60 * 1000;
firstReminderConfig.setMillis(milliValue);
firstReminderConfig.setEmailTemplateName("Workitem Email template");
managerConfigs.add(firstReminderConfig);

//differenceOfDays is attribute used for calculate the end date and current date diff based, on selection on the form//

//Second Reminder
ReminderConfig secondReminderConfig = new ReminderConfig();
secondReminderConfig.setEnabled(true);
int days1 = differenceOfDays - 14;
long milliValue1 = days1 * 24L * 60 * 60 * 1000;
secondReminderConfig.setMillis(milliValue1);
secondReminderConfig.setEmailTemplateName("Workitem Email template");
managerConfigs.add(secondReminderConfig);

NotificationConfig notifConfig = new NotificationConfig();
notifConfig.setEnabled(true);
notifConfig.setRemindersEnabled(true);
notifConfig.setConfigs(managerConfigs);
item.setupNotificationConfig(context, null, notifConfig);

context.saveObject(item);
context.commitTransaction();

Thanks,

I would say please revisit the requirement , To me it’s doesn’t make any sense to auto approve the request if no one takes action even after sending the reminder . despite of auto approve request should expire .

2 Likes

if you are auto approving after reminder you can land up with audit finding / issues.

1 Like

Hi @reddyc9

Hope this thread helps your requirement:

https://community.sailpoint.com/t5/IdentityIQ-Forum/How-to-do-workitem-AccessRequest-as-Auto-approve-and-promote-to/td-p/53793

Just FYI, it is not best practice to auto-approve (you may foresee audit issues)

Thanks

2 Likes

I didn’t see any logic to auto approve after sending reminders. But If you’re trying to do auto approve you need to fetch the Approval Item and update. Below is the sample code.

item.setState(WorkItem.State.Finished);

1 Like

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