IdentityNow Rule Guide - Before Provisioning Rule

IdentityNow Rule Guide - Before Provisioning Rule

 

Purpose

This rule is used to modify a provisioning plan as provisioning is sent out. This rule should not be used to create new attributes, instead an account creation profile (provisioning policy) should be used.

 

Execution

  • Cloud Execution - This rule executes in the IdentityNow cloud, and has read-only access to IdentityNow data models, however it doesn't have access to on-premise sources or connectors.

 

 

Input

Argument Type Purpose
idn sailpoint.server.IdnRuleUtil

Provides a read-only starting point for using the SailPoint API. From this passed reference, the rule can interrogate the IdentityNow data model including identities or account information via helper methods as described here.

plan sailpoint.object.ProvisioningPlan A set of provisioning instructions which are sent to the source connectors.
application sailpoint.object.Application A representation of the configured source, and its configuration attributes.

 

Note: logs are not supported for BeforeProvisioning rules. 

Output

Argument Type Purpose
     

 

Template

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="Example Rule" type="BeforeProvisioning">
  <Description>Describe your rule here.</Description>
  <Source><![CDATA[

  // Add your logic here.

  ]]></Source>
</Rule>

 

Example

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="Example Rule" type="BeforeProvisioning">
  <Description>Before Provisioning Rule which changes disables and enables to a modify.</Description>
  <Source><![CDATA[
import sailpoint.object.*;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AccountRequest.Operation;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.Operation;

for ( AccountRequest accountRequest : plan.getAccountRequests() ) {   
  if ( accountRequest.getOp().equals( ProvisioningPlan.ObjectOperation.Disable ) ) {
    accountRequest.setOp( ProvisioningPlan.ObjectOperation.Modify );
  }
  if ( accountRequest.getOp().equals( ProvisioningPlan.ObjectOperation.Enable ) ) {
    accountRequest.setOp( ProvisioningPlan.ObjectOperation.Modify );
  }
}

  ]]></Source>
</Rule>

 

Labels (1)
Comments

How we can iterate through entitlements for particular user is this before provisioning rule in identityNow ?

@yashbarot Here is a method you can add to get the entitlements as a list, and then you can iterate through the list to get the individual values.

 

  public List getAttributeValuesList (AccountRequest acctReq){
    log.error("======Running method to get entitlement attributes on the account request(s)======");
    List entitlements = new ArrayList();
    if (acctReq != null) {
      //The next line, replace "role" with your entitlement schema attribute
      AttributeRequest attributes = acctReq.getAttributeRequest("role");
      if (attributes != null) {
        Object entList = attributes.getValue();
        
        //if single entitlement, add it to list, if array, iterate and add to list
        if (entList instanceof String) {
          entitlements.add((String) entList);
          log.error("======getAttributeValue has single Entitlement: " + entList);
        }else if (entList instanceof List){
          log.error("======getAttributeValue has list of: " + entList);
          for (String entitlement : entList){
            log.error("++++Adding entitlement value " + entitlement + " to entitlements array list.");
            entitlements.add((String)entitlement);
          }
        }
          if (entitlements != null && !entitlements.isEmpty()) {
            log.error("======List of role values" + entitlements + "======");
            return entitlements;
        }
      }
    }
    return null;
  }

@cassidiopia Thank you for the solution. 

Is there a way to add a wait to the provisioning rules? Observational evidence is that our AD account is being created faster than the identity attributes/transforms resulting in a RACE condition.
This means that intermittently the AD accounts are being created incorrectly for sAMAccount details.

Thanks

Version history
Revision #:
6 of 6
Last update:
‎Sep 10, 2021 08:10 AM
Updated by: