Skip to content

getTicketsCount is returning the wrong number #21

@graytonio-dsm

Description

@graytonio-dsm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions