# Dynamic approval for entitlements

**URL:** <https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024>\
**Category:** IIQ Discussion and Questions\
**Tags:** identityiq\
**Created:** [November 27, 2024, 2:02pm UTC](https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024 "2024-11-27T14:02:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikantdeloitte](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@srikantdeloitte](https://developer.sailpoint.com/discuss/u/srikantdeloitte)\
**Post date:** [November 27, 2024, 2:02pm UTC](https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024/1 "2024-11-27T14:02:59Z")

</div>

Hi,

I have requirement where i need to have manager,owner serial approval for AD Entitlement and only Owner for serviceNow entitlement.Our default approvalscheme is owner.Is there anyway to hadle this scenario ?

---

<div class="post-metadata">

**Author:** ![Arun-Kumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/arun-kumar/32/15128_2.png) [@Arun-Kumar](https://developer.sailpoint.com/discuss/u/Arun-Kumar)\
**Post date:** [November 27, 2024, 2:24pm UTC](https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024/2 "2024-11-27T14:24:43Z")

</div>

Hi @srikantdeloitte,

This can be achived by ApprovalAssignment rule.

---

<div class="post-metadata">

**Author:** ![srikantdeloitte](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@srikantdeloitte](https://developer.sailpoint.com/discuss/u/srikantdeloitte)\
**Post date:** [November 28, 2024, 7:39am UTC](https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024/3 "2024-11-28T07:39:05Z")

</div>

Hi Arun,

i tried with below code but not able to achieve.Can you please help me:

List newApprovals = new ArrayList();  
if (approvals != null){  
for ( Approval approval : approvals ){  
if ( approval != null ) {  
log.error("Expanded old approval : "+approval.toXml());

```
    List childApprovals = approval.getChildren();
    if ( childApprovals != null &amp;&amp; !childApprovals.isEmpty()){
      for ( Approval child : childApprovals ){
        log.error("1st child get");
        List&lt;ApprovalItem>itemList=approvalSet.getItems();
        for(ApprovalItem item :itemList){
          if(item.getApplicationName().equalsIgnoreCase("ServeMe")){
            item.setOwner(manager+","+"26935");
            child.setOwner(manager+","+"26935");
            newApprovals.add(child);
							log.error("manager and owner has been set");
          }else{
            item.setOwner("26935");
            child.setOwner("26935");
            newApprovals.add(child);
            log.error(" owner has been set");
          }
        }
      }
    }else{
      approval.setOwner("26935");
      newApprovals.add(approval);
      log.error("owner has been set in else");
    }

  }
}

```

}

if ( newApprovals != null && newApprovals.size() \> 0 ){  
log.error("new Approvals "+newApprovals);  
for ( Approval approval : newApprovals ) {  
log.error("Expanded new approval : "+approval.toXml());  
}  
log.error(“approvalSet:”+approvalSet.toXml());  
return newApprovals;

}

return approvals;

---

<div class="post-metadata">

**Author:** ![sreeram](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sreeram/32/25311_2.png) [@sreeram](https://developer.sailpoint.com/discuss/u/sreeram)\
**Post date:** [December 3, 2024, 6:11pm UTC](https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024/4 "2024-12-03T18:11:37Z")

</div>

When you attempted the scenario with this rule, could you describe the behavior?

---

<div class="post-metadata">

**Author:** ![srikantdeloitte](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@srikantdeloitte](https://developer.sailpoint.com/discuss/u/srikantdeloitte)\
**Post date:** [December 19, 2024, 9:16am UTC](https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024/5 "2024-12-19T09:16:45Z")

</div>

@sreeram : When I tried with above code ,i was not able to achieve to get the right owner incase when I am requesting with two different application entitlement having two different owners. I know I have hardcoded the owner value but incase also I dynamically set the owner then also it was not achievable.

---

<div class="post-metadata">

**Author:** ![mkumariaas](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/mkumariaas/32/40387_2.png) [@mkumariaas](https://developer.sailpoint.com/discuss/u/mkumariaas)\
**Post date:** [December 30, 2024, 4:00pm UTC](https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024/6 "2024-12-30T16:00:31Z")

</div>

@srikantdeloitte You can use one with example rule as this rule is not complete rule.  
u can refer this link or many other.  
[https://community.sailpoint.com/t5/IdentityIQ-Forum/ApprovalAssignment-Rule/m-p/235423](https://community.sailpoint.com/t5/IdentityIQ-Forum/ApprovalAssignment-Rule/m-p/235423)

---

<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:** [February 28, 2025, 4:00pm UTC](https://developer.sailpoint.com/discuss/t/dynamic-approval-for-entitlements/91024/7 "2025-02-28T16:00:49Z")

</div>

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