Approval Reminder and Reassignment

krempec_3
Tera Contributor

I have a User Approval in a workflow. If this isn't approved in 48 hours, we need to send another notification reminder. If this isn't answered in 5 days, we need to reassign it to a group. Is there a good way to do this for this specific Workflow Activity?

1 ACCEPTED SOLUTION

Tanaji Patil
Tera Guru

Looking at your requirement I think it's better to handle this in your existing RITM (or any other task) workflow as you also need to generate a group approval in case not approved in 5 days.

Here's how I would go with it-
1) in your existing workflow on the Approval - User activity add another condition for cancelled (or no longer required state). This will have transacrion to Approval - Group activity. So in case User approval is cancelled workflow will generate Group approval.
2) in Approval - Group use the advanced script option. In this script add the user to generate approval and using gs.eventQueueScheduled() schedule 2 events (first after 2 days for reminder notification; second after 5 days for cancellation and group approval generation) in future. In event parameters pass approver and ticket sys_id.
3) Create a reminder notification from the first event. In condition/additional script check that the approval is still in requested state. So if not requested in 2 days this notification gets triggered else nothing happens.
4) Create a script action from the second event. Here check again if the state of the approval is requested and if yes then cancel the manual approval.
5) This cancellation will triggered the group approval in the RITM workflow.

Instead of gs.eventQueueScheduled() you could also use workflow/BR on syaapproval_approver table but that will be more difficult to determine which is the approval on which you need this approval to be triggered.
You could also decide to do this logic within the same workflow by adding a parallel set of activities (timer followed by if condition followed by runscript) to the User Approval activity.

-Tanaji
Please mark this reply correct/helpful if applicable

View solution in original post

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

you can configure workflow on sysapproval_approver table and use timer, wait for condition activities to send reminders and assign to group.

I have implemented this workflow and it works well.

 

Regards,

Sachin

Tanaji Patil
Tera Guru

Looking at your requirement I think it's better to handle this in your existing RITM (or any other task) workflow as you also need to generate a group approval in case not approved in 5 days.

Here's how I would go with it-
1) in your existing workflow on the Approval - User activity add another condition for cancelled (or no longer required state). This will have transacrion to Approval - Group activity. So in case User approval is cancelled workflow will generate Group approval.
2) in Approval - Group use the advanced script option. In this script add the user to generate approval and using gs.eventQueueScheduled() schedule 2 events (first after 2 days for reminder notification; second after 5 days for cancellation and group approval generation) in future. In event parameters pass approver and ticket sys_id.
3) Create a reminder notification from the first event. In condition/additional script check that the approval is still in requested state. So if not requested in 2 days this notification gets triggered else nothing happens.
4) Create a script action from the second event. Here check again if the state of the approval is requested and if yes then cancel the manual approval.
5) This cancellation will triggered the group approval in the RITM workflow.

Instead of gs.eventQueueScheduled() you could also use workflow/BR on syaapproval_approver table but that will be more difficult to determine which is the approval on which you need this approval to be triggered.
You could also decide to do this logic within the same workflow by adding a parallel set of activities (timer followed by if condition followed by runscript) to the User Approval activity.

-Tanaji
Please mark this reply correct/helpful if applicable

Hi @Tanaji Patil ,

I have a similar requirement, where there is a workflow that is triggering approvals for users and if that user doesn't approves or rejects the approval

1. After 48 hours of creation of approval then send reminder email 1

2. After 96 hours of creation of approval then send reminder email 2

3. After 144 hours of creation cancel the approval.

So yes, I did create the additional condition for cancellation in my user approval activity and mapped the activity.results = "cancellation", and also have my eventQueueScheduled, but my workflow doesn't proceeds forward if the approval is getting set to cancelled from a script action after 144 hours. It is stuck and had do "Nudge" workflow in the context to move forward. Moreover, when nudged it follows the approval path.

I tried checking the community for having custom transition option in approval activity and all I found is a wiki link that is no longer accessible. Below is the link

http://wiki.servicenow.com/index.php?title=Custom_Transitions_for_the_Approval_-_User_Activity#gsc.tab=0


What I suspect that we need to inform the workflow that the approval is cancelled and also certain script in the approval activity that sets the activity answer to cancelled in wait for scripted condition.


Also, i came across the below script API in one of the community posts [Link is below] and the function used "broadcastEventToCurrentsContexts" is not documented by ServiceNow.

https://community.servicenow.com/community?id=community_question&sys_id=1ed187a9db98dbc01dcaf3231f96197f

new Workflow().broadcastEventToCurrentsContexts(gr, 'update', null);

Is it good to have Business Rule on sysapproval_approver table for cancellation as described in the link.

Please suggest!!

Thanks & Regards,
Rupam
 
 

Jagriti Singh
Giga Contributor

You can use flow designer. You can trigger conditions on sysapproval table and lookup the records which are in requested state. Set the timer accordingly for the wait condition and check the approval state if it is in requested state for more than 3 days you can send the reminder.