mcohen01 / node-quickbooks

nodejs client for Intuit's Quickbooks API
332 stars 235 forks source link

findEmployees not finding all employees #94

Closed DatScreamer closed 6 years ago

DatScreamer commented 6 years ago

Issue: I'm only getting 9 out of 11 employees (11 employees are listed in Quickbooks) back from qbo.findEmployees function.

It may be worth noting that both of the missing employees are admin users, but one of the non-missing employees is also an admin user.

Because the promise is resolved I'm inclined to think that it's not my code but an issue with node-quickbooks.

        async function findEmployees() {
            return new Promise(
                (resolve, reject) => {
                    // GET EMPLOYEES
                    qbo.findEmployees([
                        {field: 'fetchAll', value: true}
                    ], function(e, employees) {
                        let i = 0;
                        if (typeof employees.QueryResponse !== 'undefined') {
                            employees.QueryResponse.Employee.forEach(function(employee) {

                                //
                                // Add employee to local database
                                //

                                console.log("Create Employee");

                                i++;

                                if(employees.QueryResponse.Employee.length === i) {
                                    var fulfilled = 'Fulfilled 2';
                                    resolve(fulfilled);
                                }

                            })
                        } else {
                            console.log(e);
                            reject();
                        }

                    });
                }
            );
        };
DatScreamer commented 6 years ago

The missing employees are missing when exporting the employee list from quickbooks built-in WebUI export function as well. Due to this I am closing the issue as the problem is not with node-quickbooks but Quickbooks itself. Still looking for answers though