From e155cd30bfbf7bf697f60ea115dc129d49d0b0e9 Mon Sep 17 00:00:00 2001 From: Becks Date: Fri, 3 Oct 2025 22:36:23 -0400 Subject: [PATCH 1/4] Create README.md --- .../Auto Approve VIP Approvals/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md diff --git a/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md b/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md new file mode 100644 index 0000000000..83a5aef752 --- /dev/null +++ b/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md @@ -0,0 +1,17 @@ +## Description: +This Business Rule will auto-approve an Approval [sysapproval_approver] record when the approver and the Requested for on a RITM are the same. This allows VIP users to receive the services they requested faster and avoid and unecesary approval step in the process. + +## Usage Instructions/Examples: +This script is specfic for RITM's but could easily be refactored to work for other approvals on the platform (i.e. change requests). + +#### When to run values: + +- When: after +- Insert: true +- Update: false + - Note: This could be updated to true if needed for your business process +- Filter Conditions: Source table is sc_req_item AND State changes to Requested + - Note: The source table can be changed to other tables such as change_request + +## Prerequisites/Dependencies: +1) From d127a0a409b7cf8797b00db296908ead13dc7443 Mon Sep 17 00:00:00 2001 From: Becks Date: Fri, 3 Oct 2025 22:38:50 -0400 Subject: [PATCH 2/4] Update README.md part dos --- .../Business Rules/Auto Approve VIP Approvals/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md b/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md index 83a5aef752..98287e3e83 100644 --- a/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md +++ b/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md @@ -1,5 +1,5 @@ ## Description: -This Business Rule will auto-approve an Approval [sysapproval_approver] record when the approver and the Requested for on a RITM are the same. This allows VIP users to receive the services they requested faster and avoid and unecesary approval step in the process. +This Business Rule will auto-approve an Approval [sysapproval_approver] record when the approver and the Requested for on a RITM are the same. This allows VIP users to receive the services they requested faster and avoid an unecesary approval step in the process. ## Usage Instructions/Examples: This script is specfic for RITM's but could easily be refactored to work for other approvals on the platform (i.e. change requests). @@ -14,4 +14,4 @@ This script is specfic for RITM's but could easily be refactored to work for oth - Note: The source table can be changed to other tables such as change_request ## Prerequisites/Dependencies: -1) +1) A Catalog Item with approvals from VIP users From 0bc71712b297b624b65420ad5d14b0ff7079384e Mon Sep 17 00:00:00 2001 From: Becks Date: Fri, 3 Oct 2025 22:41:20 -0400 Subject: [PATCH 3/4] Create script.js --- .../Auto Approve VIP Approvals/script.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Server-Side Components/Business Rules/Auto Approve VIP Approvals/script.js diff --git a/Server-Side Components/Business Rules/Auto Approve VIP Approvals/script.js b/Server-Side Components/Business Rules/Auto Approve VIP Approvals/script.js new file mode 100644 index 0000000000..9b9c43797d --- /dev/null +++ b/Server-Side Components/Business Rules/Auto Approve VIP Approvals/script.js @@ -0,0 +1,15 @@ +(function executeRule(current, previous /*null when async*/ ) { + // Query the requested item to get the requested_for user + var grReqItem = new GlideRecord('sc_req_item'); + grReqItem.get(current.sysapproval); + var requestedFor = grReqItem.request.requested_for; + + // Check if the approver is the same as the requested_for user AND a VIP User + if (requestedFor == current.approver && current.approver.vip == true) { + current.setValue('state', 'approved'); + current.update(); //Only needed because this is an after BR, remove this if you decide to do a before BR + + grReqItem.comments = "This request was auto-approved due to Requester's VIP status."; + grReqItem.update(); + } +})(current, previous); From 42af468891ebfd250c50b74f9de95272a443b5eb Mon Sep 17 00:00:00 2001 From: Becks Date: Fri, 3 Oct 2025 22:48:19 -0400 Subject: [PATCH 4/4] added more details to the readme --- .../Business Rules/Auto Approve VIP Approvals/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md b/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md index 98287e3e83..674f7b59a0 100644 --- a/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md +++ b/Server-Side Components/Business Rules/Auto Approve VIP Approvals/README.md @@ -1,5 +1,5 @@ ## Description: -This Business Rule will auto-approve an Approval [sysapproval_approver] record when the approver and the Requested for on a RITM are the same. This allows VIP users to receive the services they requested faster and avoid an unecesary approval step in the process. +This Business Rule will auto-approve an Approval [sysapproval_approver] record when the Approver and the Requested for on a RITM are the same, and the user is a VIP User. This allows VIP users to receive the services they requested faster and avoid an unecesary approval step in the process. ## Usage Instructions/Examples: This script is specfic for RITM's but could easily be refactored to work for other approvals on the platform (i.e. change requests). @@ -7,6 +7,8 @@ This script is specfic for RITM's but could easily be refactored to work for oth #### When to run values: - When: after + - Note: This could run before, but I choose to make an update on another table (aka add a comment to the RITM about the auto-approval) + - Note 2: If you choose to run this before, please remove the 'current.update()' from line 11 in the script - Insert: true - Update: false - Note: This could be updated to true if needed for your business process @@ -15,3 +17,4 @@ This script is specfic for RITM's but could easily be refactored to work for oth ## Prerequisites/Dependencies: 1) A Catalog Item with approvals from VIP users +2) A business process that allows VIP Users to bypass their own approvals