# Remove requested entitlements on termination

**URL:** <https://developer.sailpoint.com/discuss/t/remove-requested-entitlements-on-termination/18117>\
**Category:** SHF Discussion and Questions\
**Tags:** identity-security-cloud\
**Created:** [September 25, 2023, 2:24pm UTC](https://developer.sailpoint.com/discuss/t/remove-requested-entitlements-on-termination/18117 "2023-09-25T14:24:11Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![RAKGDS](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/rakgds/32/2795_2.png) [@RAKGDS](https://developer.sailpoint.com/discuss/u/RAKGDS)\
**Post date:** [September 26, 2023, 11:32am UTC](https://developer.sailpoint.com/discuss/t/remove-requested-entitlements-on-termination/18117/6 "2023-09-26T11:32:23Z")

</div>

Hi Dylan,

What you can do is create a new method in Service Standard Rule with the name removeStickyEntitlements and have the following added.

public void removeEntitlementsStickiness(Identity identity, AccountRequest accountRequest, String attribute)  
{  
log.debug("Enter removeEntitlementsStickiness: " + attribute);  
if(accountRequest == null)  
{  
log.error(“RemoveEntitlements: Invalid Arguments: accountRequest is null”);  
return;  
}  
if(attribute == null) {  
log.error(“RemoveEntitlements: Invalid Arguments: attribute is null”);  
return;  
}  
if(identity == null) {  
log.error(“RemoveEntitlements: Invalid Arguments: Identity is null”);  
return;  
}

```
	Account account = getAccount(identity, accountRequest);
	AccountRequest.Operation op = accountRequest.getOperation();
	if(null != idn.getRawAccountAttribute(account, attribute) && op!=null)
	{

		List ents = asList(idn.getRawAccountAttribute(account, attribute));
		if(ents != null) 
		{
			for (String ent:ents)
			{
				AttributeRequest attrRequest= new 
                                    AttributeRequest(attribute, ProvisioningPlan.Operation.Remove,ent);
				attrRequest.put("assignment", true);									
				accountRequest.add(attrRequest);									

			}	

		}
	}
	log.debug("Exit removeEntitlementsStickiness");
}

```

Once done please configure a trigger like below

[

```
{

    "op": "add",

    "path": "/connectorAttributes/cloudServicesIDNSetup",

    "value": {

        "eventConfigurations": [

            {

                "eventActions": [

                    {

                        "Action": "RemoveEntitlementsStickiness",

                        "Attribute": "memberOf",

                        "Value": null

                    }

                ],

                "Identity Attribute Triggers": [

                    {

                        "Attribute": "cloudLifecycleState",

                        "Value": "inactive",

                        "Operation": "eq"

                    }

                ],

                "Operation": "Disable"

            }

        ]

    }

}

```

]

Let me know if you face any issues in the same

---

_[View the full topic](https://developer.sailpoint.com/discuss/t/remove-requested-entitlements-on-termination/18117)._
