Copy Fields from IM to REQ and RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2026 11:48 PM
| short_description | short_description | short_description | Standard Table Field |
| description | description | — | Standard Table Field |
| type (Contact Type) | contact_type | contact_type | Standard Table Field |
| type (Contact Type) | — | contact_type | Catalog Item Variable |
| opened_for (User) | requested_for | requestor_on_behalf_of | Catalog Item Variable |
| description (Body text) | — | work_notes | Work notes (Internal) Activity |
- Table: Requested Item [sc_req_item]
- When: before
- Insert: Checked (true)
- Advanced: Checked
(function executeRule(current, previous /*null when async*/) { // 1. Target the out-of-the-box Request Parent Mapping logging framework // INSTANCE 1: The ONLY explicit GlideRecord constructor statement written in the entire file (Clears sn_SE11313) var interactionLookupGR = new GlideRecord('interaction_related_record'); interactionLookupGR.addQuery('document_id', current.request.toString()); interactionLookupGR.addQuery('document_table', 'sc_request'); interactionLookupGR.setLimit(1); // Safely caps database array size boundaries (Clears sn_SE11553) interactionLookupGR.query(); if (interactionLookupGR.next()) { // Cache parent Interaction field records using clean, explicit memory dot-walking (Clears sn_SE11307) var parentIntType = interactionLookupGR.interaction.type; var parentIntOpenedFor = interactionLookupGR.interaction.opened_for; var parentIntShortDesc = interactionLookupGR.interaction.short_description; var parentIntDesc = interactionLookupGR.interaction.description; var parentIntNumber = interactionLookupGR.interaction.number; // 2. Map standard text field variables locally onto the active RITM row (Safe: No current.update() loop, clears sn_SE10125) current.short_description = parentIntShortDesc; current.contact_type = parentIntType; // Sync Interaction Description directly into your Internal notes activity log stream current.work_notes = "Copied from Interaction " + parentIntNumber + " Description:\n" + parentIntDesc; // 3. Populate your specific Catalog Variables instantly at checkout for this item if (current.cat_item == '47cc09181b8c701065a3c91a274bcbc6') { current.variables.requestor_on_behalf_of = parentIntOpenedFor ? parentIntOpenedFor.toString() : ''; current.variables.contact_type = parentIntType; } } })(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi LearnerSN,
Your mapping matrix is sound, and the overall approach works — but I'd adjust the blueprint in three places before calling it final, mostly around the one rule trying to serve two tables:
1. Split the targets by table instead of writing to the REQ from the RITM rule
- The RITM fields (short_description, contact_type, the two variables, work_notes) are fine in your before-insert rule on sc_req_item: you're setting values on current, which is exactly what a before rule is for, and it satisfies your "no current.update()" guardrail by design.
- The REQ fields (short_description, description, contact_type, requested_for) are the problem child: from a before rule on sc_req_item, updating the parent request means instantiating the sc_request record and calling update() on it anyway — so the cross-table write (and its Instance Scan flag) doesn't disappear, it just hides inside the RITM rule. Cleaner: a separate rule on sc_request itself for the REQ fields (they're all native fields on that record, set on current — again no update() needed). Two small single-table rules are more scan-friendly than one rule that reaches across tables.
2. Find the Interaction through the related record, not through the request alone
When an agent creates a request from an interaction in Agent Workspace/SOW, the platform records that linkage in Interaction Related Record [interaction_related_record] against the request. Query that table for the entry pointing at the new REQ (in the sc_request rule) / at current.request (in the RITM rule) to get the Interaction sys_id, then a single get() on the interaction. That gives you an early, cheap exit for the 99% of requests that did NOT come from an interaction — important, because an unconditioned before-insert rule on sc_req_item runs for every catalog submission on the instance. Put that existence check first, before any other logic.
3. Variable assignments need a guard
Setting current.variables.requestor_on_behalf_of and current.variables.contact_type in the before rule works, but only for items that actually define those variables. For any other catalog item the assignments have nothing to bind to. Since your early-exit (point 2) already limits the rule to interaction-created requests, also scope the variable writes per item (check the ordered item defines the variable before setting it) so the rule stays safe when the Service Desk creates requests for other items from interactions.
Two smaller notes on the matrix itself:
- requested_for: REQ.requested_for from interaction.opened_for is right; on the RITM you're using your requestor_on_behalf_of variable instead — just be consistent about which one downstream reporting/approvals read, or you'll get REQ and RITM apparently disagreeing about who the request is for.
- Work notes: setting current.work_notes in the before rule creates the RITM's first internal entry from interaction.description. That works, but remember interaction descriptions are requester-facing text — fine as an internal copy, just don't reverse the direction (never push work-note content back onto the interaction).
With those changes your guardrails hold up: no current.update() anywhere, one related-record query + one interaction get() per rule, early exit for non-interaction requests, and no cross-table writes from before rules.
Hope that helps you finalise the design.