ApprovalAssignmentRule error: Unable to find the approval assignment

Which IIQ version are you inquiring about?

Version 8.3

Share all details related to your problem, including any error messages you may have received.

Hi team,
I have one requirement which is to add an additional approval in case it comes as a true one role attribute. For this I created an approvalAssignmentRule.
According to the logs the rule is executed without problems and reaches the end, but I get an error “Unable to find the approval assignment [null]”.

Here es mi code

import sailpoint.object.*;
import sailpoint.object.Link;
import sailpoint.object.Bundle;
import sailpoint.object.Identity;
import sailpoint.object.ManagedAttribute;
import sailpoint.object.Workflow.Approval;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

System.out.println("************* ENTERING THE Approval Assignment Rule **************");
List approvals = new ArrayList();

try {

Approval mgr = new Approval();
String description = "Approval - Account Changes for User: " + identityName;
System.out.println("**********  Description *********::" + description);


for (ApprovalItem item : approvalSet.getItems())
{
System.out.println("**********approvalSet item object *********::" + item.toXml());

   //Get Role Name           
      Object itemValueObj =  item.getValue();
   if (itemValueObj instanceof String)
     roleName = (String) itemValueObj;
   else
     roleName = itemValueObj.get(0);   
 
      //Get Role attribute using Role Name
	
	System.out.println("********** Nombre del rol *********::" + roleName );
   Bundle rol = context.getObjectByName(Bundle.class, roleName);
String owner = "Certificadores de accesos";
Boolean critico = rol.getAttribute("Critico");
	System.out.println("********** critico  *********::" + critico );
  
  
if (critico) {
System.out.println("********** IF dentro del rol classifications *********::" );

mgr.setWorkItemDescription(description);
mgr.setDescription(description);
mgr.setOwner(owner);
mgr.setMode("serial");
mgr.setApprovalSet(approvalSet);
approvals.add(approval);
System.out.println("********** Añadida aprobacion certificadores de accesos *********::");

}

}
}
catch (Exception e)
{
System.out.println("exception in setting approval"+e.printStackTrace());

}
  System.out.println("TERMINA");
return approvals;

If anyone knows how I can solve this it would help me a lot.
Thanks in advance

Hi @Gianlu97

Welcome to SailPoint developer community.

change the above line to

approvals.add(mgr);

Then try again.

2 Likes

Hi Krishna,

Thank you for your quick response.
Unfortunately, I keep getting the following error Unable to find the approval assignment [sailpoint.object.Workflow$Approval@7c2bf9f4].
The rule is set in the LCM Provisioning, in the Approve and Provision step, and in the approve and provision subprocess.

Can you suggest please anything else to try?

Thank you so much

Try adding the below lines as well.

    mgr.addArg("workItemTargetClass", "sailpoint.object.Identity");
    mgr.addArg("workItemTargetName", owner );

Jarin,

Thanks four your support.
The good news is the error doesn’t appear anymore, but it doesn’t generate any approval.

Do you see any other error why I would not be getting the approvals?
Thanks

Hi @Gianlu97,

Can you share the logs to get a better idea what is happening.

Hi Jarin,

Sorry for the delay.
There are attached the logs of a Critical role request, and it should set the 3rd level of approval. But it is running without any approval level.

Thanks for your support.
log approval assignment rule.txt (29.4 KB)

Hi Jarin,

Let me know you that I fixed the error but unfortunately it does not add this group as a 3rd approval step, but remains as the only approval step.

Do you know how to fix it?
Thanks

Hi @Gianlu97,

Sorry for the delay. Remove the following entry from the rule

List approvals = new ArrayList();

approvals variable is passed via the input arguments. Adding the new approval to this should fix your issue.

Hi Jarin,

I know it’s been a long time, but we just detected an error. And it is that if there is more than 1 role that must have that third approval, when approving the approvals it gets stuck in “Waiting” state for the Access Request.

Do you have any idea?
Thanks in advance

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.