I need to create a business rule to auto approve a RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 01:03 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 11:56 AM
@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!!
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 12:15 PM
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);