I need to create a business rule to auto approve a RITM

Vijayenthiran S
Tera Contributor

Hi All,

 

I want to auto-approve an approval task if the approver is also the Requestor.

 

For example, if the workflow has opened_by manager approval, and now the Manager is submitting a request on behalf of a team member, the RITM should be auto-approved. 

11 REPLIES 11

shyamkumar VK
Kilo Patron

@Vijayenthiran S  , why cant you use an if activity before your approval activity and do validation in the if activity like 

comparing variable values or the values which you want to compare , if condition does not match move this to approval activity , if matches set the approval to approved using workflow activity [

 

Example script :

answer = ifScript();

function ifScript() {
if (current.opened_by == current.variables.requested_for.manager) {
		return 'yes';
	}
	return 'no';
}

 

replace with your values in the above script!!

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

g k1
Tera Guru

 

table : sc_req_item
When to Run: Before , insert

 

(function executeRule(current, previous /*, gs*/) {
// Check if the RITM meets the criteria for auto approval
if (/* Add your condition here */) {
// Set the approval field to true
current.approval = 'approved';
}
})(current, previous);