Page 1 of 1

Job.Createdatabase

Posted: Tue Apr 11, 2023 3:34 pm
by Sunnyland
I am trying to add a json database that I have used a script to create. I can add the database without issue but I am having trouble sending back via webhook once the database is added.

this is the final lines of the code

let jsondata = JSON.stringify(iqobj);
let fileid = makeid(5);

let jsonpath = "C:\\Switch\\Temps Folder\\Json Files\\"
await fs.writeFileSync(jsonpath + fileid, jsondata + ".json")
await job.createDataset("iqJson",jsonpath + fileid,DatasetModel.JSON)


await job.sendToSingle();
await fs.unlinkSync(jsonpath + fileid + ".json");

the json is added to the job as expected but I am using subflow to transport the jobs via http, once the json is added I get an error when we attempt to send the job back to the original flow.

Error in line 169 of script : Undefined member function 'getPath' for object 'undefined' of type: 'Undefined'

Comment out this line and the flow works as expected - await job.createDataset("iqJson",jsonpath + fileid,DatasetModel.JSON)

So the problem is when I attach the json file to the job.

Re: Job.Createdatabase

Posted: Tue Apr 11, 2023 4:13 pm
by Padawan
Is it possible that you are not using the latest version of Subflow? Version 4 introduced support for JSON datasets and should fix this.

Re: Job.Createdatabase

Posted: Tue Apr 11, 2023 4:38 pm
by Sunnyland
Yes thanks, I was using version 3