Auto Approve Role Removal in approvalAssignmentRule

Which IIQ version are you inquiring about?

8.5

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

We have an approvalAssignmentRule in the LCM Provisioning workflow that works as intended when adding (requesting) a role.

This rule is also unfortunately triggering when removing a role from a user, we don’t want the approval logic to effect removal requests.

We tried returning null in the approval list, but that even removes the request operations and everything involved. Looking to see if this is something someone has working for them.

Thanks!

Please follow the below link to achieve it. Here it is a code related role auto approve, you can write a similar ones for application entitlements

https://community.sailpoint.com/t5/IdentityIQ-Forum/Approval-Assignment-Rule-skips-requests/m-p/60166/thread-id/58150

In the approval assignment rule, you will get the approval set which contains all the required approval. We can iterate through the all items, check if it is for remove then mark it finished and then removed from the original approval set.

try the below sample code

      List originalItems = approvalSet.getItems();
      List itemsToRemove = new ArrayList();
      
      for(ApprovalItem curritem: originalItems){
        if (curritem.getOperation().equalsIgnoreCase("Remove")) {
               curritem.approve();
               curritem.setState(WorkItem.State.Finished);
               curritem.setOwner("spadmin");
               itemsToRemove.add(curritem);        
         }
      }
      
      log.error( "Done modified approvalSet is :"+itemsToRemove);
      
      if(!Util.isEmpty(itemsToRemove)){
        if(!(itemsToRemove.size() == originalItems.size() && itemsToRemove.containsAll(originalItems) && originalItems.containsAll(itemsToRemove))) {
          for(ApprovalItem curritem: itemsToRemove){
            approvalSet.remove(curritem);
          }
        }
      }
      
      log.error( "modified approvalSet is" + approvalSet.toXml());
1 Like

You can iterate each approval item from ApprovalSet and set each item like below
item.setState(WorkItem.State.Finished);

Or you can simply remove ApprovalItem from ApprovalSet.

1 Like

Ankush Shirbhate and Aakash Pandita, thank you very much, this solution worked for me.

1 Like