in query, why sometimes AND so.status IN ('A', 'B'...
# ask-stanley-ai
t
in query, why sometimes AND so.status IN ('A', 'B', 'D', 'E', 'F') works correctly and sometimes AND so.status IN ('SalesOrd:A', 'SalesOrd:B', 'SalesOrd:D', 'SalesOrd:E', 'SalesOrd:F') works correctly
c
AI generated answer (using internal Slack threads):
The behavior you're observing is due to the way NetSuite handles transaction statuses in different contexts. In SuiteScript, when you're querying the
status
field of a transaction, the values you're comparing against are the internal IDs of the status, not the display values. These internal IDs are typically in the format
SalesOrd:A
,
SalesOrd:B
, etc. However, in other contexts such as the browser console, NetSuite Script Debugger, or SQuirreL SQL, the
status
field may be interpreted differently. In these contexts, the
status
field may be interpreted as the display value of the status, not the internal ID. This is why you're seeing different results when you use
AND so.status IN ('A', 'B', 'D', 'E', 'F')
versus
AND so.status IN ('SalesOrd:A', 'SalesOrd:B', 'SalesOrd:D', 'SalesOrd:E', 'SalesOrd:F')
. In the case of the User Event script, it seems that the query is being run as a subquery. In this context, the
status
field is being interpreted as the internal ID, which is why the query with the
SalesOrd:
prefix is returning results. In summary, the way the
status
field is interpreted can vary depending on the context in which the query is run. When writing your queries, you'll need to take into account the context and adjust your query accordingly. ****** 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.812347472
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.793274
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.789123654
Please provide your feedback on this answer.