# Native change detection

**URL:** <https://developer.sailpoint.com/discuss/t/native-change-detection/54129>\
**Category:** IIQ Discussion and Questions\
**Tags:** workflows, rules, identityiq, provisioning\
**Created:** [April 25, 2024, 9:57am UTC](https://developer.sailpoint.com/discuss/t/native-change-detection/54129 "2024-04-25T09:57:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aradhana\_Mohapatra](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Aradhana\_Mohapatra](https://developer.sailpoint.com/discuss/u/Aradhana_Mohapatra)\
**Post date:** [April 25, 2024, 9:57am UTC](https://developer.sailpoint.com/discuss/t/native-change-detection/54129/1 "2024-04-25T09:57:54Z")

</div>

### 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.

We are setting up a workflow with the operation of revoke for all connected applications in sailpoint choosing entitlement option and we have a condition of shared entitlement for multiple roles so need suggestions of setting up a provisioning plan for the operation logics.  
import sailpoint.api.SailPointContext;  
import sailpoint.object.sailpoint.object.NativeChangeDetection;  
import sailpoint.tools.Util;import sailpoint.object.ProvisioningPlan;  
import sailpoint.object.AccountRequest;

List ops = new ArrayList();

Identity managerIdentity = context.getObjectByName(Identity.class, identityName).getManager();

String managerName = managerIdentity.getName();

EmailOptions emailOptions = new EmailOptions();

if ( event != null ) {

```
List ncs = event.getNativeChanges();

if ( ncs != null ) {

    for ( NativeChangeDetection nc : ncs ) {

        AccountRequest.Operation op = nc.getOperation();

        String opString;

        if ( op == null ) 

            opString = "Modify";

        else

            opString = op.toString();

        if ( !ops.contains(opString) ) {

            ops.add(opString);

        }

        // If a native change is detected, add a Revoke operation

        // It checks if a native change (nc) has been detected. If nc is not null, it means a native change has been detected.

        if (nc != null) {

        opString = "Remove"; 

        //If a native change is detected, it sets opString to "Remove". This could be indicating that the operation to be performed in response to the native change is a revocation.

        if (!ops.contains(opString)) {

        ops.add(opString);

            }  

        //It then checks if "Remove" is already in the ops list. If it's not, it adds "Remove" to the ops list.
        //This list might be used later in the workflow to perform the operations it contains.
        // Send a notification email to the line manager

            Identity LineManager = identityManager.getManager();

            if (lineManager != null) {

                emailOptions.setTo(Manager.getEmail());

                emailOptions.setTemplate("NotificationEmailTemplate");

                emailOptions.setNotificationVariables(Util.mapOf("identity", identity, "operation", opString));

                context.sendEmailNotification(emailOptions);

            }

        }

    }

}

```

}  
}  
}  
return Util.listToCsv(ops);

---

<div class="post-metadata">

**Author:** ![iamksatish](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/iamksatish/32/26217_2.png) [@iamksatish](https://developer.sailpoint.com/discuss/u/iamksatish)\
**Post date:** [April 25, 2024, 10:21am UTC](https://developer.sailpoint.com/discuss/t/native-change-detection/54129/2 "2024-04-25T10:21:48Z")

</div>

@Aradhana_Mohapatra  
Can you be more clear on what exactly you are looking for

---

<div class="post-metadata">

**Author:** ![ismaelmoreno1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ismaelmoreno1/32/2756_2.png) [@ismaelmoreno1](https://developer.sailpoint.com/discuss/u/ismaelmoreno1)\
**Post date:** [April 25, 2024, 10:25am UTC](https://developer.sailpoint.com/discuss/t/native-change-detection/54129/3 "2024-04-25T10:25:48Z")

</div>

Hi @Aradhana_Mohapatra

Could you provide more information about what process or events you need launch.?

If you want delete the accounts the accouns you can use this code

```auto
ProvisioningPlan plan = new ProvisioningPlan();	
plan.setIdentity(identity);	
		
AccountRequest accReq = new AccountRequest(AccountRequest.Operation.Delete, "Name_APP", null, nativeId);				
accReq.setNativeIdentity(nativeId);
plan.add(accReq);

```

---

<div class="post-metadata">

**Author:** ![Aradhana\_Mohapatra](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Aradhana\_Mohapatra](https://developer.sailpoint.com/discuss/u/Aradhana_Mohapatra)\
**Post date:** [April 25, 2024, 3:35pm UTC](https://developer.sailpoint.com/discuss/t/native-change-detection/54129/4 "2024-04-25T15:35:23Z")

</div>

We have shared entitlements for various IT roles . We are setting up a workflow for all connected applications to detect native change with entitlements i.e if any access is getting provisioned locally outside of sailpoint platform.

The NCD process of IIQ works on trigger snapshot concept i.e it will check for any native change before and after aggregation tasks.

For shared entitlement scenario, we are only setting up revoke operation where if native change is detected it will run the operation for modify and then revoke.

Above is the logic for the string operation that we are intending to set up. So I need suggestions on the provisioning plan to run this workflow.

As part of attribute request we can only set up group code .With our set up role name will be difficult to fetch as a single entitlement is shared across various IT roles.

---

<div class="post-metadata">

**Author:** ![Aradhana\_Mohapatra](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Aradhana\_Mohapatra](https://developer.sailpoint.com/discuss/u/Aradhana_Mohapatra)\
**Post date:** [April 25, 2024, 3:39pm UTC](https://developer.sailpoint.com/discuss/t/native-change-detection/54129/5 "2024-04-25T15:39:55Z")

</div>

As part of trigger event, we want native change to get detected(prior to this we will enable connected application with native change option for entitlements with operations of modify and delete.) With provisioning plan we want the workflow to go through the string operations and remove the detected entitlement from user profile.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [June 24, 2024, 3:40pm UTC](https://developer.sailpoint.com/discuss/t/native-change-detection/54129/6 "2024-06-24T15:40:14Z")

</div>

Closed on June 24, 2024, 3:40pm UTC

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