IdentityNow BeforeProvisioning Rule issue

I have created the BeforeProvisioning cloud rule and attached to the AD source for account moves for Disable/Enable and department changes. On IdentityProfile Provisioning tab, Configured the AD source to disable the account on LCS “inactive” on IdentityProfile. The issue is the AD account on target is not getting disabled after the Identity LCS is changed to inactive. Please let me know if any correction required for below rule and how to resolve the issue

<?xml version='1.0' encoding='UTF-8'?> Moves AD account for mover or termination use cases. Also remove additional groups <![CDATA[ import sailpoint.object.ProvisioningPlan; import sailpoint.object.ProvisioningPlan.AccountRequest; import sailpoint.object.ProvisioningPlan.AccountRequest.Operation; import sailpoint.object.ProvisioningPlan.AttributeRequest; import sailpoint.object.Identity; import java.util.ArrayList; import java.util.List;

try {
log.info(“Active Directory Before Provisioning Rule - START”);
List accountRequests = plan.getAccountRequests();
if (accountRequests != null) {
for (AccountRequest accountRequest: accountRequests) {
AccountRequest.Operation op = accountRequest.getOperation();
if (op == null) continue;
String nativeIdentity = accountRequest.getNativeIdentity();
Identity identity = plan.getIdentity();
String currentLCS = null;
String activeOU = null;
String disabledOU = null;
if (identity != null) {
currentLCS = identity.getAttribute(“cloudLifecycleState”);
activeOU = identity.getAttribute(“activeOu”);
disabledOU = identity.getAttribute(“disabledOU”);
}

  boolean departmentChanged = false;
  if (op.equals(AccountRequest.Operation.Modify)) {
    List depAttrReqs = accountRequest.getAttributeRequests("department");
    List campAttrReqs = accountRequest.getAttributeRequests("extensionAttribute2");
    if ((depAttrReqs != null) && (!depAttrReqs.isEmpty())) {
      departmentChanged = true;
    } else if ((campAttrReqs != null) && (!campAttrReqs.isEmpty())) {
      departmentChanged = true;
    }
  }

  String newOU = null;
  /*
      Get a new OU only if we are in 
          Rehire Use Case: (Enable, user LCS is active and user was in the disabled OU)
          Mover Use Case: (Modify and user LCS is active)
          Termination Use Case: (Disable and user LCS is inactive)
  */
  if ("active".equals(currentLCS) && op.equals(AccountRequest.Operation.Enable) &&
    disabledOU != null && activeOU != null && nativeIdentity.endsWith(disabledOU)) {
    //Rehire Use Case
    newOU = activeOU;
  } else if ("active".equals(currentLCS) && departmentChanged && activeOU != null) {
    //Mover Use Case
    newOU = activeOU;
  } else if ("inactive".equals(currentLCS) && op.equals(AccountRequest.Operation.Disable)) {
    //Termination Use Case
    newOU = disabledOU;
  }
  if (newOU != null && !nativeIdentity.endsWith(newOU)) {
    //Account not currently in the proper OU. Put them there
    // check if new OU is already set in DISABLE/UPDATE account profiles
    List newParentAttrReqs = accountRequest.getAttributeRequests("AC_NewParent");
    if ((newParentAttrReqs != null) && (!newParentAttrReqs.isEmpty())) {
      for (AttributeRequest attrRequest: newParentAttrReqs) {
        attrRequest.setValue(newOU);
      }
    } else {
      accountRequest.add(new AttributeRequest("AC_NewParent", ProvisioningPlan.Operation.Set, newOU));
    }

    //if campaign/dept is changed, remove all the groups except domain users
    if (departmentChanged) {
      String domainUsersDN = identity.getStringAttribute("domainUsersDN");
      if (!domainUsersDN.isEmpty() && !domainUsersDN.isBlank()) {
        List newGroups = new ArrayList();
        newGroups.add(domainUsersDN);
        accountRequest.add(new AttributeRequest("memberOf", ProvisioningPlan.Operation.Set, newGroups));
      }
    }
  }
}

}
} catch (Exception ex) {
log.error("Active Directory Before Provisioning Rule - Exception occured: ", ex);
log.error("Provisioning Plan: " + plan);
}
log.info(“Active Directory Before Provisioning Rule - END”);
]]>

Hi @vspatil2211 ,

Welcome to Developer Community!

Hope below highlighted settings has been configured for “Inactive” LCS

Yes it is added to disable the AD source for inactive LCS,

Can you show us the data from the event to see what is being sent?

PFA events details when the identity changed to inactive.

@vspatil2211 Go to “Account activity” tab and open the record for AD and see if the account operation passed is disable

Thanks for the inputs…Earlier the Disable operation was not triggering due to some other source errors. Now the account is getting disabled BUT its again executing “ENABLE ACCOUNT PASSED” event within few moments, How to identity which Role/process is triggering this even again and resolve it? PFA screenshot for details

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