Create Multiple Ritm based on Multirow Variable set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 04:44 AM
Hi All,
I have Requirement need to create multiple ritm based Multirow Variable set. Based on adding rows create ritms
ex: if user add 4 rows in variable set, 4 ritms has to create under one REQ. IN every ritm variable should be populated. Then 1st row in variable set has to populate in 1st ritm , 2nd variable set has to populate in 2nd like that for all ritms. Please help me on this requirement.
Thanks
Suresh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 04:53 AM
you can utilize a combination of workflows and scripting. Here's a step-by-step approach to implement this:
Step 1: Set Up the Multi-row Variable Set
- Create a Multi-row Variable Set: Define the multi-row variable set in your catalog item with the necessary variables (e.g., name, description, etc.).
Step 2: Workflow Configuration
Create a Workflow: Design a workflow that will handle the creation of RITMs based on the multi-row entries.
Add a Script to Process Multi-row Entries: Use a script within the workflow to iterate over the multi-row variable set and create individual RITMs for each row.
Step 3: Script to Create RITMs
Here's a sample script to guide you through the process:
(function executeWorkflow(current, previous) { // Get the Multi-row Variable Set var multiRowVariableSet = current.variables.multi_row_variable_set; // Replace with your actual variable set name // Iterate through each row in the Multi-row Variable Set for (var i = 0; i < multiRowVariableSet.length; i++) { var row = multiRowVariableSet[i]; // Create a new RITM var ritmGR = new GlideRecord('sc_req_item'); ritmGR.initialize(); ritmGR.request = current.sys_id; // Link to the current REQ ritmGR.short_description = 'RITM for ' + row.variable_name; // Customize as needed ritmGR.insert(); // Populate the RITM with variables from the row // Assuming you have variables like 'variable_name', 'variable_description', etc. ritmGR.variables.variable_name = row.variable_name; ritmGR.variables.variable_description = row.variable_description; // Add more variables as needed ritmGR.update(); } })(current, previous);
Step 4: Workflow Execution
Attach the Workflow to the Catalog Item: Ensure the workflow is attached to the catalog item so that it executes when a request is submitted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 05:08 AM
Hi @Nilesh Pol,
We trying create flow designer, help me with flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 05:13 AM
Guide to Using Flow Designer
Step 1: Set Up the Multi-row Variable Set
- Create a Multi-row Variable Set: Define the multi-row variable set in your catalog item with the necessary variables (e.g., name, description, etc.).
Step 2: Create a Flow in Flow Designer
Navigate to Flow Designer: Go to Flow Designer in ServiceNow.
Create a New Flow: Click on New to create a new flow.
Define the Trigger:
- Set the trigger to Service Catalog and specify your catalog item. This will ensure the flow starts when a request for this item is submitted.
Step 3: Add Actions to the Flow
Add an Action to Iterate Over Multi-row Variable Set:
- Use the For Each action to iterate over the rows in the multi-row variable set.
- You'll need to reference the multi-row variable set from the catalog item. This can typically be done by accessing the variable set directly in the flow.
Create RITMs for Each Row:
- Within the For Each loop, add a Create Record action.
- Set the table to sc_req_item (Requested Item).
- Map the fields in the RITM to the variables from the current row in the multi-row variable set. For example:
- Request: Set this to the sys_id of the current request.
- Short Description: Use a combination of static text and variables from the row to create a meaningful description.
- Map other variables as needed to populate the RITM.
Update RITM Variables:
- If your RITM requires specific variables to be set, ensure that these are mapped from the multi-row variable set fields.
Step 4: Test the Flow
Submit a Request: Test the flow by submitting a request for the catalog item with multiple rows in the multi-row variable set.
Verify RITMs: Check that the correct number of RITMs are created and each is populated with the appropriate variables from the multi-row variable set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 06:05 AM
Hi @Nilesh Pol ,
Only one ritm is creating by using this script