Workitem has to be Auto approved After 3rd Reminder

Hi @harishabn ,

You can create a Scheduled Rule that runs daily and performs the following:

  • Queries all pending Remove access approval work items.
  • Checks if they’ve been open for 10 days (based on created timestamp).
  • Programmatically executes approval (WorkItem.setOutcome("Approve")) and routes completion.

:page_facing_up: Sample Logic (Rule Skeleton)

import sailpoint.object.Filter;
import sailpoint.object.WorkItem;
import sailpoint.api.Workflower;
import java.util.Date;
import java.util.List;
import java.util.Calendar;

Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -10);
Date cutoff = cal.getTime();

// Filter all pending work items older than 10 days
Filter filter = Filter.and(
    Filter.eq("state", "Pending"),
    Filter.le("created", cutoff)
);

List workItems = context.getObjects(WorkItem.class, filter);

Workflower workflower = new Workflower(context);

for (WorkItem item : workItems) {
    if ("Remove".equalsIgnoreCase(item.getType())) {
        log.info("Auto-approving stale remove request: " + item.getName());
        item.setOutcome("Approve");
        workflower.completeWorkItem(item);
    }
}

:locked: Make sure you add filtering to only process the work items you care about, like LCM Remove Approval, and avoid escalation or exception queues if configured.

Hope this helps! :rocket: Let me know if you have any questions.

2 Likes