# Workitem AutoApproval After Sending Reminders

**URL:** <https://developer.sailpoint.com/discuss/t/workitem-autoapproval-after-sending-reminders/73968>\
**Category:** IIQ Discussion and Questions\
**Tags:** workflows, identityiq, work-items\
**Created:** [July 24, 2024, 4:45pm UTC](https://developer.sailpoint.com/discuss/t/workitem-autoapproval-after-sending-reminders/73968 "2024-07-24T16:45:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![san1385](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@san1385](https://developer.sailpoint.com/discuss/u/san1385)\
**Post date:** [July 24, 2024, 4:45pm UTC](https://developer.sailpoint.com/discuss/t/workitem-autoapproval-after-sending-reminders/73968/1 "2024-07-24T16:45:18Z")

</div>

Hi,

Could someone please help on the below with sample code,

Need to Auto Approve the Workitem after sending the reminders.

Using below logic, to send the reminders, working good. But after sending all those reminders, need to auto approve the workitem.

```auto
// First Reminder

ReminderConfig firstReminderConfig = new ReminderConfig();
firstReminderConfig.setEnabled(true);
int days = differenceOfDays - 21;
System.out.println("days value is ----->"+days);
long milliValue = days * 24L * 60 * 60 * 1000;
firstReminderConfig.setMillis(milliValue);
firstReminderConfig.setEmailTemplateName("Workitem Email template");
managerConfigs.add(firstReminderConfig);

//differenceOfDays is attribute used for calculate the end date and current date diff based, on selection on the form//

//Second Reminder
ReminderConfig secondReminderConfig = new ReminderConfig();
secondReminderConfig.setEnabled(true);
int days1 = differenceOfDays - 14;
long milliValue1 = days1 * 24L * 60 * 60 * 1000;
secondReminderConfig.setMillis(milliValue1);
secondReminderConfig.setEmailTemplateName("Workitem Email template");
managerConfigs.add(secondReminderConfig);

NotificationConfig notifConfig = new NotificationConfig();
notifConfig.setEnabled(true);
notifConfig.setRemindersEnabled(true);
notifConfig.setConfigs(managerConfigs);
item.setupNotificationConfig(context, null, notifConfig);

context.saveObject(item);
context.commitTransaction();

```

Thanks,

---

<div class="post-metadata">

**Author:** ![vishal\_kejriwal1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vishal_kejriwal1/32/10904_2.png) [@vishal\_kejriwal1](https://developer.sailpoint.com/discuss/u/vishal_kejriwal1)\
**Post date:** [July 24, 2024, 4:49pm UTC](https://developer.sailpoint.com/discuss/t/workitem-autoapproval-after-sending-reminders/73968/2 "2024-07-24T16:49:33Z")

</div>

I would say please revisit the requirement , To me it’s doesn’t make any sense to auto approve the request if no one takes action even after sending the reminder . despite of auto approve request should expire .

---

<div class="post-metadata">

**Author:** ![vishal\_kejriwal1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vishal_kejriwal1/32/10904_2.png) [@vishal\_kejriwal1](https://developer.sailpoint.com/discuss/u/vishal_kejriwal1)\
**Post date:** [July 24, 2024, 4:50pm UTC](https://developer.sailpoint.com/discuss/t/workitem-autoapproval-after-sending-reminders/73968/3 "2024-07-24T16:50:26Z")

</div>

if you are auto approving after reminder you can land up with audit finding / issues.

---

<div class="post-metadata">

**Author:** ![Sriindugula](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sriindugula/32/14041_2.png) [@Sriindugula](https://developer.sailpoint.com/discuss/u/Sriindugula)\
**Post date:** [July 24, 2024, 5:43pm UTC](https://developer.sailpoint.com/discuss/t/workitem-autoapproval-after-sending-reminders/73968/4 "2024-07-24T17:43:18Z")

</div>

Hi @reddyc9

Hope this thread helps your requirement:

[https://community.sailpoint.com/t5/IdentityIQ-Forum/How-to-do-workitem-AccessRequest-as-Auto-approve-and-promote-to/td-p/53793](https://community.sailpoint.com/t5/IdentityIQ-Forum/How-to-do-workitem-AccessRequest-as-Auto-approve-and-promote-to/td-p/53793)

Just FYI, it is not best practice to auto-approve (you may foresee audit issues)

Thanks

---

<div class="post-metadata">

**Author:** ![vedeepak](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vedeepak/32/14735_2.png) [@vedeepak](https://developer.sailpoint.com/discuss/u/vedeepak)\
**Post date:** [July 25, 2024, 2:33pm UTC](https://developer.sailpoint.com/discuss/t/workitem-autoapproval-after-sending-reminders/73968/5 "2024-07-25T14:33:51Z")

</div>

I didn’t see any logic to auto approve after sending reminders. But If you’re trying to do auto approve you need to fetch the **Approval Item** and update. Below is the sample code.

` item.setState(WorkItem.State.Finished);`

---

<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:** [September 23, 2024, 2:34pm UTC](https://developer.sailpoint.com/discuss/t/workitem-autoapproval-after-sending-reminders/73968/6 "2024-09-23T14:34:16Z")

</div>

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