An example for the Rule:
import sailpoint.object.*;
int deletionPercentage = 10;
List taskDefs = context.getObjects(TaskDefinition.class, new QueryOptions().addFilter(Filter.eq("parent.name","Account Aggregation")));
for (TaskDefinition td : taskDefs) {
String appName = td.getString("applications");
if (!appName.contains(",")) {
int accountCount = context.countObjects(Link.class, new QueryOptions().addFilter(Filter.eq("application.name",appName)));
int checkDeletedThreshold = 10;
if (accountCount > 100) {
checkDeletedThreshold = accountCount * deletionPercentage / 100;
}
td.setArgument("checkDeleted", "true");
td.setArgument("checkDeletedThreshold", String.valueOf(checkDeletedThreshold));
context.saveObject(td);
}
}
context.commitTransaction();
You can run this rule:
- via debug (Run Rule)
- via the Rule Runner Plugin
- via a ‘Run Rule’-task (preferred option, as this can also be scheduled).
I hope this helps,
PS Do not directly run this in a production environment.
– Remold