How to upload the data using flow designer.

mohdzeeshan
Kilo Contributor

Hi Community,

I'm currently building a process to upload Configuration Items (CIs) into the cmdb_ci table. The requirement is as follows:

  1. A catalog form allows users to upload CI data via an Excel sheet.
  2. Once the request is submitted and approved, the data should be automatically uploaded into the CMDB.

I’ve created a flow in Flow Designer to handle the process, and everything is working fine up to the approval stage. However, I'm facing a challenge with uploading the Excel data into the cmdb_ci table.

Could you please advise:

  1. Is it possible to upload the Excel data into the table directly using Flow Designer?
  2. If yes, then what is the approach to do this using flow?
  3. If not, what would be the best approach to achieve this using scripting (e.g., Script Includes or other server-side logic) so that the data gets uploaded automatically after approval?

Any guidance would be appreciated.

Thanks!

1 REPLY 1

pratikjagtap
Giga Guru

Hi @mohdzeeshan ,

Not directly. Flow Designer is not built to parse Excel files out of the box. You can work with attachments and run some logic, but Excel parsing and record creation typically require server-side scripting.

 

Try following steps:

1.Catalog Item + File Upload

  • Use a Catalog Item with a File attachment variable (type: File).
  • Users upload the Excel sheet here.

2.Flow Designer to handle submission and approval
You're already doing this:

  • Submit request
  • Wait for approval
  • After approval, trigger server-side script to process the file

4.Post-Approval: Server-Side Script to Parse Excel + Insert CI Records
Once approved, use a Flow Action or Script Include to:

  • Retrieve the attachment
  • Parse the Excel file
  • Loop through rows and insert/update CIs in cmdb_ci

Implementation Steps

 

Step 1: Retrieve the Attachment
You can use a Script step in Flow or a Script Include. Here’s how to retrieve the file:

var grAttachment = new GlideRecord('sys_attachment');
grAttachment.addQuery('table_name', 'sc_req_item'); // or whatever your form table is
grAttachment.addQuery('table_sys_id', current.sys_id);
grAttachment.query();

if (grAttachment.next()) {
var attachmentSysId = grAttachment.sys_id.toString();
// Proceed to parse it
}

Step 2: Parse Excel File (Use GlideExcelParser)
To parse Excel files, you can use the GlideExcelParser API:

var parser = new GlideExcelParser();
parser.setSheetIndex(0); // First sheet
parser.parse(attachmentSysId);

while (parser.next()) {
var name = parser.getValue('Name');
var assetTag =

 

If my response helped, please hit the 👍Thumb Icon and accept the solution so that it benefits future readers.

 

Regards,
Pratik