How to load a data from a data source using a flow designer

lawrencesenpai
Tera Contributor

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: 

lawrencesenpai_0-1687431919421.png

And here is my flow

lawrencesenpai_1-1687431955936.png

 

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!

 

9 REPLIES 9

I changed the input value to sys id

lawrencesenpai_0-1687440265353.png

 

Hello Ankur,

 

I am working on a requirement to Add/Remove users to Shared Mailbox in Azure AD from Servicenow using Flow Designer. I have used the Microsoft Azure AD Spoke for this.

 

I have a requirement to add multiple users in the RITM. I have created an attachment variable in the catalog item as I am using the same through VA as well which does not support List Collector variables. Now, if a user adds list of users through an excel in the RITM, how can I extract this data in the Flow Designer to pass the users for removal in Azure AD?
Hope I have explained the requirement correctly.

karora7
Tera Contributor

Hi @lawrencesenpai,

Did you ever solve this issue? I am trying to do the same thing and create an action that will fetch the attachment from catalog item form and map it to an existing data source and do the transform. 

Hi, I ditched the flow designer and went to a business rule instead as the error is persistent when I was trying to do it on the flow. 

ArgyriosA
Tera Contributor

Hello @lawrencesenpai
I had a similar requirement and I also watched Goran's video,
I did the same steps and I was stuck for like an hour trying to figure out why I got no import set sys id as an output.
I got burned so I asked a colleague to take a look at the custom action code and after a few minutes, he noticed that the last line seemed incorrect.
Please change the last line of code in your import set action like this:
outputs.importset = importSetRec.getUniqueValue();
The above solved my issue so I hope it will solve yours as well.