Job.Createdatabase

Post Reply
Sunnyland
Member
Posts: 56
Joined: Mon Aug 19, 2013 1:34 am

Job.Createdatabase

Post 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.
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Job.Createdatabase

Post 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.
Sunnyland
Member
Posts: 56
Joined: Mon Aug 19, 2013 1:34 am

Re: Job.Createdatabase

Post by Sunnyland »

Yes thanks, I was using version 3
Post Reply