We recently started running the process to archive process for certifications. We are seeing an issue where the archive does not move the Completed certifications where there was ‘Nothing to Certify’. Is there a way to archive these certifications and/or delete them programmatically?
1 Like
We ended up writing a rule to remove them.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="Rule-RuleRunner-PruneNothingToCertifyCertifications">
<Description>Rule used to prune filtered provisioningTransactions</Description>
<Signature returnType="String">
<Inputs>
<Argument name="context">
<Description>The current SailPointContext</Description>
</Argument>
<Argument name="taskResult">
<Description>The current task result object.</Description>
</Argument>
<Argument name="taskExecutor">
<Description>The current RuleExecuter object</Description>
</Argument>
<Argument name="config">
<Description>The current config Map passed in from the task definiton</Description>
</Argument>
</Inputs>
<Returns>
<Argument name="taskResult">
<Description>The resulting task result object, or null if no update is required.</Description>
</Argument>
</Returns>
</Signature>
<Source>
import java.util.List;
import sailpoint.object.QueryOptions;
import sailpoint.object.Filter;
import sailpoint.object.CertificationGroup;
import sailpoint.api.Terminator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Log logger = LogFactory.getLog("psu.rule.prunecertifications");
Object returnValue;
logger.debug("----SearchNothingCertifications Start----");
List<CertificationGroup> certGroupObjects = context.getObjects(CertificationGroup.class);
if(certGroupObjects == null || certGroupObjects.size() == 0){
logger.debug("No Cert Found. Returning null.");
return null;
}
for(CertificationGroup cGroup : certGroupObjects) {
String name = cGroup.getName();
logger.debug("cGroup Name: " + name);
int totalCerts = cGroup.getTotalCertifications();
logger.debug("totalCerts: " + totalCerts);
if(totalCerts == 0) {
logger.debug("About to delete: \n" + cGroup.toXml());
Terminator terminator = new Terminator(context);
terminator.deleteObject(cGroup);
}
}
logger.debug("----SearchNothingCertifications End End----");
context.decache();
return null;
</Source>
</Rule>