Skip to content

Commit 1c89803

Browse files
Create Change README.md
1 parent 0ee01b6 commit 1c89803

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Safe Approval Reassignment Script — Dummy User
2+
Overview
3+
4+
This ServiceNow background script safely reassigns an approval for a given record.
5+
Instead of directly overwriting the existing approver (which is not recommended), it:
6+
7+
Marks the current approval as “No Longer Required”.
8+
9+
Creates a new approval for a dummy user in the sys_user table.
10+
11+
This approach ensures safe testing, demos, or Hacktoberfest contributions without impacting real approvals or notifications.
12+
13+
Features
14+
15+
Safe & Best Practice: Avoids overwriting existing approvals that may have already triggered notifications.
16+
17+
Dynamic: Can be reused for any parent record by changing parentSysId.
18+
19+
Dummy User: Uses a placeholder user to safely test or demonstrate approval assignment.
20+
21+
Clear Logging: Outputs info/warning messages for easy verification.
22+
23+
How to Use
24+
25+
Create a dummy user in the sys_user table (mandatory).
26+
27+
Update the script with:
28+
29+
parentSysId → sys_id of the record whose approval you want to reassign.
30+
31+
dummyApproverName → Name field of the dummy user in sys_user.
32+
33+
Open Scripts – Background in your ServiceNow instance.
34+
35+
Paste the script and run.
36+
37+
Check the system logs for info/warnings about the reassignment.
38+
39+
Example Output
40+
Existing approval marked as not required for record: d2cdb552db252200a6a2b31be0b8f5ee
41+
New approval assigned to Dummy for record: d2cdb552db252200a6a2b31be0b8f5ee
42+
43+
Notes
44+
45+
Ensure the dummy user exists in the sys_user table; otherwise, the script will warn Dummy user not found.
46+
47+
This script is read-only for the old approval and only modifies workflow safely for testing.
48+
49+
Can be easily extended to handle multiple approvals or multiple dummy users for more complex scenarios.

0 commit comments

Comments
 (0)