How to load a data from a data source using a flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 04:07 AM
I need help on importing a data from an excel file using a flow designer triggered by a catalog item.
I am trying to load a data using a data source to my import set table.
All in global scope
I already created an action flow with this code :
var loader = new GlideImportSetLoader();
var importSetRec = loader.getImportsetGr(inputs.dataSource);
var ranload = loader.loadImportSetTable(importSetRec, inputs.dataSource);
importSetRec.state = "loaded";
importSetRec.update();
outputs.importSet = importSetRec.getUniqueValue();
But it throws an error : Error: Can't find method com.glide.system_import_set.ImportSetLoader.loadImportSetTable(undefined,object). (Process Automation.ae416dbd1bafed10494ceb9cbc4bcbc3; line 4)
Here is my script step image:
And here is my flow
Here is the code for my transform map action :
(function execute(inputs, outputs) {
var transformWorker = new GlideImportSeTransformWorker(inputs.importSetSysID, inputs.transformMap.getUniqueValue());
transformWorker.setBackground(true);
transformWorker.start();
})(inputs, outputs);
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 05:21 AM
I already created blog for the same few years ago; but it uses workflow.
Similar script you can try to use in flow designer
Data load and transform via Catalog Item
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 05:22 AM
the error clearly says importSetRec is undefined
seems that object is not getting initialized properly
are you sending correct data source sysId
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 05:57 AM
Hi Ankur,
The images are were I initialize the data source sys ID
And also, I will be checking your blog, Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 06:06 AM
can you try to hard-code the data source sysId here?
var importSetRec = loader.getImportsetGr('sysIdHere');
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader