- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 06:41 AM
Hello,
Looking for some help. I have a catalog item that creates multiple SC tasks and after they are all complete the workflow creates a Change Request. How can I map the variables from the RITM to show in the change request? Or at least populate them into the Change Request description field?
Thanks,
Dillin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 06:13 AM
I was actually able to more easily solve this. In flow designer I was able to query the RITM and variables form that and add them to the description field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 07:01 AM
Create a Script in the Workflow: Add a script in the workflow just before the creation of the Change Request. This script will read the variables from the RITM and store them in a way that the Change Request can use.
// Get the RITM record
var ritmGr = new GlideRecord('sc_req_item');
ritmGr.get(current.sys_id);
// Initialize an empty string to store the description
var description = '';
// List of variables to include in the Change Request
var variables = ['variable1', 'variable2', 'variable3']; // Replace with your variable names
// Loop through each variable and append to description
for (var i = 0; i < variables.length; i++) {
var variableName = variables[i];
var variableValue = ritmGr[variableName];
if (variableValue) {
description += variableName + ': ' + variableValue + '\n';
}
}
// Store the description in the workflow scratchpad
workflow.scratchpad.change_description = description;
Update the Change Request Creation Script: Modify the script that creates the Change Request to use the workflow.scratchpad.change_description value:
// Create the Change Request record
var changeGr = new GlideRecord('change_request');
changeGr.initialize();
changeGr.short_description = 'Change Request from RITM ' + current.number;
changeGr.description = workflow.scratchpad.change_description;
// Set other fields as needed
changeGr.insert();
i hope my answer helps you to resolve your issue, if yes mark my answer helpful and correct.
THANK YOU
rajesh chopade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 07:03 AM
how are you creating the CHG? are you using flow or workflow?
which variables from RITM should be mapped with which fields of CHG?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 06:41 AM
Hi Ankur,
I am creating the Change Request from the Catalog Item Workflow. I want the variables jut to populate into the Description of the Change or even just show as variables on the form if possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2024 06:13 AM
I was actually able to more easily solve this. In flow designer I was able to query the RITM and variables form that and add them to the description field.