Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getTicketsCount is returning the wrong number #21

Open
graytonio-dsm opened this issue Jul 23, 2019 · 0 comments
Open

getTicketsCount is returning the wrong number #21

graytonio-dsm opened this issue Jul 23, 2019 · 0 comments

Comments

@graytonio-dsm
Copy link

I am attempting to use the API to integrate ConnectWise with a company portal and using the getTicketsCount to determine how many pages to create. However when I use the node API I get the wrong number. When I directly used to API to run the same query I received the correct value. Example shown below.

getCompanyTickets: function(id, page=1, pageSize=25, search="") {
        return new Promise(function(resolve, reject) {
            const conditions = `company/id = ${id} and closedFlag = false`;
            cw.ServiceDeskAPI.Tickets.getTickets({
                "page": page,
                "orderBy": "dateEntered desc",
                "pageSize": pageSize,
                "conditions": conditions,
            }).then(tickets => {
                cw.ServiceDeskAPI.Tickets.getTicketsCount({"conditions": conditions}).then(compCount => {
                    console.log(compCount);
                    console.log(compCount.count/pageSize);
                    resolve({pages: Math.ceil(compCount.count/pageSize), list: tickets});
                }).catch(err => {
                    reject(err);
                })
            }).catch(err => {
                reject(err);
            });
        });
    },

This code returns 554 as the ticket count. However using the direct url for the API in a browser returned 161 the correct amount of tickets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant