intacct / intacct-sdk-js

Official repository of the Sage Intacct SDK for JavaScript in Node.js
https://developer.intacct.com/tools/sdk-node-js/
Apache License 2.0
23 stars 33 forks source link

Getting timeout error while filtering & sorting SODOCUMENTENTRY by WHENMODIFIED field #63

Closed karan-c3 closed 2 years ago

karan-c3 commented 3 years ago

I am trying to fetch all changed/modified records from last month API is giving me a timeout error. It used to work before we are running this query for last year, but for the last 2 or 3 weeks, it is getting timed out.

Reference Code

const filter = new IA.Functions.Common.NewQuery.QueryFilter.AndOperator()
filter.addFilter(new IA.Functions.Common.NewQuery.QueryFilter.Filter('WHENMODIFIED').greaterThan(new Date('2021-01-01') as any))
filter.addFilter(new IA.Functions.Common.NewQuery.QueryFilter.Filter('SODOCUMENT.DOCPARID').in(['Sales Order', 'Sales Invoice', 'Sales Return', 'Sales Quote', 'Web Order']))
const selectBuilder = new IA.Functions.Common.NewQuery.QuerySelect.SelectBuilder()
selectBuilder.addFields(_.map(this.columns, 'name'))
const selects = selectBuilder.selects

const orderBuilder = new IA.Functions.Common.NewQuery.QueryOrderBy.OrderBuilder()
orderBuilder.addAscending('WHENMODIFIED')
const orders = orderBuilder.orders

const query = new IA.Functions.Common.NewQuery.Query()
query.selectFields = selects
query.fromObject = 'SODOCUMENTENTRY'
query.filter = filter
query.caseInsensitive = true
query.pageSize = 100
query.orderBy = orders
query.offset = this.offset

const custResponse = await intacct.client.execute(query)
const custResult = custResponse.getResult()

I tried removing order by and restricting the date to last 1 week, but still getting the timeout error, this only happens with SODOCUMENTENTRY, we are using the same for few other entities they are working fine

dylan-holt-sage commented 2 years ago

Hey @karan-c3, are you still observing this issue? is the same happening if you manually execute via XML request?

dylan-holt-sage commented 2 years ago

If this issue is still occurring, please reopen it. Thanks