We want to run rule for all the identities in SailPoint using run rule task. rule type is of field value.
The following code will return all identities depending on which filter you provide in the query options. You can implement any logic to those cubes in the rule itself. Loop through the allIdentities list via an iterator in the rule.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="localdev_playground">
<Description>sample playground rule</Description>
<Signature>
</Signature>
<Source><![CDATA[
import sailpoint.object.*;
import sailpoint.tools.Util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Log log = LogFactory.getLog("logger.name");
QueryOptions qoId = new QueryOptions();
qoId.setCloneResults(true);
Iterator allIdentities = context.search(Identity.class, qoId);
try {
while (allIdentities != null && allIdentities.hasNext()) {
try {
Identity id = (Identity) allIdentities.next();
log.debug("logic for identity: " + id.getName());
} catch (Exception ex) {
log.error("Error occurred");
}
}
} finally {
if (allIdentities != null) {
Util.flushIterator(allIdentities);
}
}
return arg1;
]]></Source>
</Rule>
1 Like
@anubhav_varshney07 Please let us know if you need a more specific example of what you are trying to do. Otherwise the previous post should loop over all your identities within a rule.
@anubhav_varshney07
Share your rule if you have it and use case because its bit confusing as you wanted to run the rule on all identities same time you are mentioning fieldValue rule