Skip to content

Commit 5c182c0

Browse files
authored
Sync Assigned to on RITM for specific catalog item (#1397)
* This business rule updates the assigned_to field on all Requested Items (RITMs) related to a request, for a specific catalog item, by syncing it with the assigned_to value from the request. * Create readme.md * Update readme.md * Update readme.md
1 parent 4dee5e8 commit 5c182c0

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// create business rule on sc_request table
2+
(function executeRule(current, previous /*null when async*/ ) {
3+
4+
var grRITM = new GlideRecord('sc_req_item');
5+
grRITM.addQuery('request', current.sys_id);
6+
grRITM.addQuery("cat_item.sc_catalogs", "791b6df48798d9100072960d3fbb35be"); //sys_id of catalog
7+
grRITM.query();
8+
while (grRITM.next()) {
9+
grRITM.assigned_to = current.assigned_to;
10+
grRITM.update();
11+
}
12+
})(current, previous);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Script Explanation:
2+
This script is written for a Business Rule in ServiceNow. The purpose of this rule is to assign the same assigned_to value (typically a user) from the request to all related requested items (RITMs)
3+
in the same catalog for a specific catalog item.
4+
This script could be used in scenarios where, once a request is assigned to a particular user (or group), you want all the individual requested items (RITMs) tied to that request to also automatically be assigned to the same user.
5+
This ensures consistency in assignment across the items in a request.

0 commit comments

Comments
 (0)