How to upload the data using flow designer

zee15
Tera 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!

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @zee15 

 

Yes, it is do able and many cases are there for same.

 

https://www.servicenow.com/community/developer-articles/parsing-the-excel-sheet-data-use-the-data-in...

 

https://www.servicenow.com/community/now-platform-articles/how-to-parse-excel-into-servicenow-parsin...

https://community.servicenow.com/community?id=community_question&sys_id=56b747e9db1cdbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=ead94329db5cdbc01dcaf3231f96...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Medi C
Giga Sage

Hello @zee15,

 

You can follow this approach:

  1. Catalog Form with Excel Upload

    • Use a catalog item where users upload the Excel file (as attachment).

  2. Post-Approval Flow

    • In Flow Designer, after approval, add a Script step that:

      • Retrieves the attachment

      • Loads it into an Import Set table

      • Triggers the Transform Map

  3. Import Set Table

    • Create an import set table (e.g., u_import_ci_data).

    • Make sure the fields match your Excel columns.

  4. Transform Map

    • Create a Transform Map from your import set table to cmdb_ci (or specific subclass).

    • Set up field mappings, coalesce fields, and onBefore/onAfter scripts as needed.

 

Example: Script to Trigger Import Set:

(function execute(inputs, outputs) {
    var loader = new GlideImportSetLoader();
    var importSetRec = loader.createImportSetRow('u_import_ci_data', '<attachmentSysId>');

    var transformer = new GlideImportSetTransformer();
    transformer.transformAllMaps(importSetRec);
})(inputs, outputs);

Replace '<attachmentSysId>' with the actual Sys ID of the uploaded file (which you can find on the RITM or Task record).

 


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

Ankur Bawiskar
Tera Patron
Tera Patron

@zee15 

you can attach the file to data source and then trigger the transformation using custom flow action and then call that flow action within your flow

you can use Custom Action with script

check this link and script shared by Fabian

Usage of GlideImportSetLoader & GlideImportSetTransformerWorker API's from scoped Application

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@zee15 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader