Copy Fields from IM to REQ and RITM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
27m ago
The goal is to automate the transfer of specific data points from an Interaction (IM) record to both the Request (REQ) and its related Requested Item (RITM) when a Service Desk agent creates a request from the Agent Workspace / Service Operations Workspace.
A key focus is reducing double-entry for the Service Desk team by automatically mapping the Interaction text into the RITM's Work notes (Internal), while satisfying strict performance and Instance Scan guardrails (no current.update(), single GlideRecord instantiations, and no cross-table before-rule errors).
Final Data Mapping Matrix
Source Table: Interaction Target Table: Request (REQ) Target Table: Requested Item (RITM) Target Form Object Type
| 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 |
Technical Blueprint (The Final Solution Code)
- Table: Requested Item [sc_req_item]
- When: before
- Insert: Checked (true)
- Advanced: Checked
javascript
(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);
Use code with caution.
0 REPLIES 0
