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.
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.
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.