- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 01:03 AM
Hi,
Approval should get rejected if it is not approved within 5 minutes. Please let me know how to achieve this?
Thanks in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 01:12 AM
Write a scheduled job and query the sysapproval_approver table to check which are requested 5min back and set the state to rejected.
or
Write set timer (wait/if) conditions on workflow to check the requested time if it is greater than 5min set the state to rejected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 01:12 AM
Write a scheduled job and query the sysapproval_approver table to check which are requested 5min back and set the state to rejected.
or
Write set timer (wait/if) conditions on workflow to check the requested time if it is greater than 5min set the state to rejected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 01:42 AM
Hi SK,
want to understand , which approvals do you want to auto reject within 5 minutes..specific to Service Request or Change request or you want this functionality to all approvals.
Please elaborate your requirement so that we can guide you in right direction.
Regards,
Govind Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 01:56 AM
Hi Govind,
I want for Service Request.
When an order guide is submitted Request is getting created and Approval is attached which is in Requested state. Now I want to move this to Reject if it is not approved within 5 minutes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 03:00 AM
Hi SK,
In Workflow of service request use the TIMER activity.
Before Approval activity use the TIMER activity and connect it to IF activity.
workflow will wait for 5 mins, if request is not approved then if activity will run the below code and it will cancel the request.
and write the script as
var sr = new GlideRecord('sc_req_item');
sr.addQuery('active', true);
sr.addQuery('state', 'requested');
sr.addQuery('sys_created_on', '>=', gs.minutesAgo(15));
sr.query();
if(sr.next())
{
var app = new GlideRecord('sysapproval_approver');
app.addQuery('document_id', current.sys_id);
app.query();
if(app.next())
{
app.state = 'rejected';
}
}
Thanks.
Please test the code before you are using it in your instance.
Hope this might be Helpful