|
| 1 | +📘 README — Auto Assignment by Application Group Variable |
| 2 | +ServiceNow Business Rule — sc_req_item |
| 3 | +✅ Purpose |
| 4 | + |
| 5 | +This Business Rule automatically sets the Assignment Group on a Requested Item (RITM) based on the user’s selection in a catalog variable. It also updates the mapped variable value in the sc_item_option_mtom table to ensure data consistency across catalog records. |
| 6 | + |
| 7 | +🔧 Where This Script Runs |
| 8 | +Item Details |
| 9 | +Table sc_req_item |
| 10 | +When Before Insert / Before Update |
| 11 | +Script Type Business Rule |
| 12 | +Execution Scope Server-side |
| 13 | +📌 Prerequisites |
| 14 | + |
| 15 | +For this script to operate correctly: |
| 16 | + |
| 17 | +1️⃣ Catalog Variable exists on the item: |
| 18 | + |
| 19 | +Name → dummy_app_group |
| 20 | + |
| 21 | +Type → Select Box |
| 22 | + |
| 23 | +Possible Values → AppGroup A, AppGroup B, AppGroup C, etc. |
| 24 | + |
| 25 | +2️⃣ Assignment Group sys_ids should be updated to real sys_ids in Production. |
| 26 | + |
| 27 | +3️⃣ The variable that stores reference to the group must be mapped in M2M table: |
| 28 | + |
| 29 | +Name → dummy_group_variable |
| 30 | + |
| 31 | +Type → Reference (sys_user_group) |
| 32 | + |
| 33 | +4️⃣ Assignment Group field must be visible and editable on RITM. |
| 34 | + |
| 35 | +🚀 What the Script Does |
| 36 | + |
| 37 | +✔ Reads catalog variable value selected by requester |
| 38 | +✔ Matches the value and determines corresponding Assignment Group |
| 39 | +✔ Updates RITM field assignment_group |
| 40 | +✔ Updates dummy_group_variable in sc_item_option_mtom table |
| 41 | +✔ Displays info/error messages for debugging and validation |
| 42 | + |
| 43 | +🧩 Example Mapping Used in This Script |
| 44 | +Catalog Variable Value Assignment Group (Dummy sys_id) |
| 45 | +AppGroup A 11111111111111111111111111111111 |
| 46 | +AppGroup B 22222222222222222222222222222222 |
| 47 | +AppGroup C 33333333333333333333333333333333 |
| 48 | + |
| 49 | +Replace with actual assignment group sys_ids before deployment. |
| 50 | + |
| 51 | +✅ Benefits |
| 52 | +Feature Advantage |
| 53 | +Automated Group Assignment Eliminates manual errors & delays |
| 54 | +Consistency in Catalog Variables Accurate reporting and auditing |
| 55 | +Debug-Friendly Messaging Quick validation during testing |
| 56 | +🛠️ Deployment Notes |
| 57 | + |
| 58 | +Disable info messages (gs.addInfoMessage) after successful testing |
| 59 | + |
| 60 | +Maintain updates when catalog variable choices expand |
| 61 | + |
| 62 | +Avoid hard-coding by considering future enhancement → mapping object / system properties |
0 commit comments