Including overduebalance column in a SuiteQL query...
# ask-stanley-ai
a
Including overduebalance column in a SuiteQL query on the customercurrencybalance table causes it to take a very long time processing the query, and then throws the following error: An error occurred while processing your request. Reference #221.8d51c317.1771607478.b66c59cf https://errors.edgesuite.net/221.8d51c317.1771607478.b66c59cf How can I get the overduebalance in a query when it acts this way? Our account has sub-customers.
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that the
overduebalance
field is causing performance issues when included in a SuiteQL query on the
customercurrencybalance
table. This could be due to the complexity of the calculations involved in determining the overdue balance, especially when dealing with sub-customers and multiple currencies. One possible workaround is to create a free-form text field that references the native overdue balance field. This field would need to be updated via a script or workflow, as the AR report won't allow you to display calculated fields. However, this could add additional performance impacts to other processes. Another approach is to use a saved search to catch customers who have gone above their credit limit or are overdue. You can use the
consoloverduebalance
,
overduebalance
,
daysoverdue
, and
consoldaysoverdue
fields in your search criteria. Here's an example of a CASE statement you could use in your search:
Copy code
CASE  
WHEN ({amount} + {customermain.consoloverduebalance} > {customermain.creditlimit}) 
OR ({amount} + {customermain.overduebalance} > {customermain.creditlimit}) 
OR ({customermain.daysoverdue} > 30) 
OR ({customermain.consoldaysoverdue} > 30)  
THEN 1  
ELSE 0
END
Please note that these are just suggestions based on the conversations and may not work in all scenarios. You may need to adjust these approaches based on your specific requirements and NetSuite setup. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816253543
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813598514
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.804962158
Please provide your feedback on this answer.