javascriptnode.jspromisepriority-web-sdk

Priority WebSDK getRows(1) returns no data


I am using the default code from https://www.npmjs.com/package/priority-web-sdk

var configuration = {
    username: '<username>',
    password: '<password>',
    url: '<app server url>',
    tabulaini: 'tabula.ini',
    language: 3,
    company: 'demo'
};

priority.login(configuration)
  .then(()=> priority.formStart('CUSTOMERS', null, null, 'demo', 1))
  .then(form=> form.getRows(1))
  .then(rows=> console.log(rows))
  .catch(err=> console.log(err));

if i run the code with my config i get no result however if i remove form.getRows(1) and pass the result of formStart i then get a response and the form info is logged to the console i just can't seam to get any more data?

I am using node but if i include the script on the client side and run it that way then it works fine but this is insecure so not a solution.


Solution

  • the soloution was to check if the window is undefined in my code if it is then we should set it.

    if (typeof window === 'undefined') {
        global.window = {}
    }