I’ve been able to use beanshell code to create the CertificationDefinition and CertificationSchedule objects needed to start an entitlement certification. It appears in my “Certification Schedules” tab successfully.
However, no matter what I’ve tried the certification requires manually clicking “Schedule Certification” on the web app to start it. Hopefully I’m missing something simple as I’m hoping to have it scheduled using beanshell as well. Let me know if you can help. Thanks!
I was able to get it to work by setting ‘setFirstExecution’ on the CertificateSchedule, and on the Task Schedule built from it, I called three functions: ‘setNextExecution’, ‘setNextActualExecution’, and ‘addCronExpression’.
Here is a snippet of what I did to get the cert schedule to start immediately:
// We want to immediately start the schedule so I'm using the current datetime value
Date now = new Date();
// create a new certification schedule from our certification definition
CertificationSchedule cd_schedule = new CertificationSchedule(context, context.getObjectByName(Identity.class, "spadmin"), context.getObjectById(CertificationDefinition.class, "[ID of CD to Schedule]"));
cd_schedule.setFirstExecution(now);
// create a task schedule built from the CD Schedule
TaskSchedule task_schedule = cd_schedule.buildTask(context);
// set task to start now
task_schedule.setNextExecution(now);
task_schedule.setNextActualExecution(now);
task_schedule.addCronExpression(now.getSecond() + " " + now.getMinute() + " " + now.getHour() + " " + now.getDayOfMonth() + " " + now.getMonthValue() + " ? " + now.getYear());
// save task schedule
context.saveObject(task_schedule);
context.commitTransaction();
sailpoint.api.TaskManager has method runNow(TaskSchedule) - this should be better fit? Just saving the TaskSchedule object wont likely be picked up properly.