Auto approve the requests after 7 days if not approved using workflow

Kumar437
Tera Contributor

Hi, I have a requirement to auto approve the approval requests after 7 days if not approved. Please let me know if anyone has any idea.

 

Thanks in advance

6 REPLIES 6

Anand Kumar P
Giga Patron
Giga Patron

Hi @Kumar437 ,

Use timer activity in workflow timer duration for 7 days, Connect timer activity to approval activity if approval not approved after 7 days connect to script activity and approve approval.

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

Sumanth16
Kilo Patron

Hi @Kumar437 ,

 

1)After your approval activity use a timer activity and keep it as 2 days in duration 

Sumanth16_0-1710272462805.png

 

2)Then add an if activity saying if still the approval is in requested state with advanced script like below 

// This script needs to set answer to 'yes' or 'no' to indicate the state of the activity.
//
// For example,
//
answer = ifScript();

function ifScript() {

	var gr = new GlideRecord('sysapproval_approver');
	gr.addQuery('sysapproval',current.sys_id);
	gr.addQuery('state','requested');
	gr.query();
	if(gr.next())
	{
		return 'yes';
	}
	return 'no';
}

Sumanth16_1-1710272462782.png

 

 

3)After that use a approval action activity which says mark task approved

Sumanth16_2-1710272462833.png

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda