Hi,
I am writing an approval assignment rule as my requirement can’t be fulfilled by OOTB approval scheme.
I am getting below error in my approval assignment rule.
2022-02-12T13:22:54,963 WARN https-jsse-nio-443-exec-8 sailpoint.server.InternalContext:166 - Start Director Approval Assignment Rule**
2022-02-12T13:22:54,963 WARN https-jsse-nio-443-exec-8 sailpoint.server.InternalContext:166 - identity sailpoint.object.Identity@5208c5fc[id=0a0472297b971bff817b9d6c8d550a07,name=Pam Beesly]
2022-02-12T13:22:54,963 WARN https-jsse-nio-443-exec-8 sailpoint.server.InternalContext:166 - manager sailpoint.object.Identity@408a2f74[id=0a0472297b971bff817b9d6c8d740a09,name=Michael Scott]
2022-02-12T13:22:54,963 WARN https-jsse-nio-443-exec-8 sailpoint.server.InternalContext:166 - description Approval - Account Changes for User: Pam Beesly
2022-02-12T13:22:54,963 WARN https-jsse-nio-443-exec-8 sailpoint.server.InternalContext:166 - approvalSet item object <?xml version='1.0' encoding='UTF-8'?>
2022-02-12T13:22:54,963 WARN https-jsse-nio-443-exec-8 sailpoint.server.InternalContext:166 - itemDisplayName null
2022-02-12T13:22:54,963 WARN https-jsse-nio-443-exec-8 sailpoint.server.InternalContext:166 - Set description
2022-02-12T13:22:54,963 WARN https-jsse-nio-443-exec-8 sailpoint.server.InternalContext:166 - Added manager as 1st level
2022-02-12T13:22:55,073 ERROR https-jsse-nio-443-exec-8 sailpoint.server.ScriptletEvaluator:143 - Step call threw an exception:
2022-02-12T13:22:55,088 ERROR https-jsse-nio-443-exec-8 sailpoint.server.ScriptletEvaluator:144 - sailpoint.tools.GeneralException: Unable to find the approval assignment [sailpoint.object.Workflow$Approval@cd5f2a1]
at sailpoint.workflow.IdentityApprovalGenerator.buildCommonApprovals(IdentityApprovalGenerator.java:882)
at sailpoint.workflow.IdentityApprovalGenerator.buildCommonApprovals(IdentityApprovalGenerator.java:898)
at sailpoint.workflow.IdentityLibrary.buildCommonApprovals(IdentityLibrary.java:4199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Here is my code -
import sailpoint.object.Workflow;
import sailpoint.object.Workflow.Approval;
import sailpoint.object.Workflow.Step;
import java.util.Iterator;
import sailpoint.object.WorkItem;
import sailpoint.object.Identity;
import sailpoint.object.ApprovalSet;
import sailpoint.object.ApprovalItem;
log.warn(“Start Director Approval Assignment Rule**”);
List newApprovals = new ArrayList();
try {
Identity identity = context.getObjectByName(Identity.class, identityName);
log.warn("identity "+identity);
Identity manager=identity.getManager();
log.warn("manager "+manager);
Approval mgr = new Approval();
//List args = approval.getArgs();
String description = "Approval - Account Changes for User: " + identityName;
log.warn("description "+description);
for(ApprovalItem item:approvalSet.getItems()) {
log.warn("approvalSet item object "+item.toXml());
String itemDisplayName = item.getDisplayName();
log.warn("itemDisplayName "+itemDisplayName);
mgr.setWorkItemDescription(description);
mgr.setDescription(description);
log.warn(“Set description”);
mgr.setOwner(manager.getName());
mgr.setMode(“serial”);
//mgr.setArgs(args);
mgr.setApprovalSet(approvalSet);
newApprovals.add(mgr);
log.warn(“Added manager as 1st level”);
}
} catch (Exception e) {
log.error(“exception in setting approval”+e.printStackTrace());
}
return newApprovals;
I have attached this rule under “Approve and Provision” Step and “Approve and Provision Subprocess”