Creating multiple SC Tasks (one per Excel file row) under a single RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi everyone,
We currently have a catalog item that raises a request and creates a single SC Task for one user. We’re looking to enhance this same catalog item by adding an option that allows the creation of multiple SC Tasks under a single RITM.
The idea is to upload an Excel file as part of the request, where each row in the Excel should result in a separate SC Task. The values from each row should also be used to populate the catalog variables for the corresponding SC Task or on the description field on the SC Task.
Has anyone implemented a similar solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
47m ago
To achieve this, the most effective and up-to-date approach is to use Flow Designer along with a Custom Script Action.
Probable Steps:
1. Attachment added in catalog form and submitted
2.Set the flow to trigger when the Catalog Item record is created
3. Create a custom action in Flow Designer with below given code
4.Loop through rows
5.Create Catalog Task
6.Map fields dynamically to RITM variables
var attGr = new GlideRecord('sys_attachment'); attGr.addQuery('table_sys_id', inputs.ritm_sys_id); // The RITM sys_idattGr.orderByDesc('sys_created_on'); attGr.query(); if (attGr.next()) { var parser = new sn_impex.GlideExcelParser(); var attachmentStream = new GlideSysAttachment().getContentStream(attGr.sys_id); parser.parse(attachmentStream); while (parser.next()) { var row = parser.getRow(); // Example: Column 'Field1' and 'Field2' from Excel var tskField1 = row['Field1']; var tskField1 = row['Field2']; var taskGr = new GlideRecord('sc_task'); taskGr.initialize(); taskGr.request_item = inputs.ritm_sys_id; taskGr.short_description = "Task for " + tskField1; taskGr.description = "Details from Excel: " + tskField2; taskGr.insert(); } }
