SELECT * FROM customrecord_new_record nr INNER JOI...
# ask-stanley-ai
a
SELECT * FROM customrecord_new_record nr INNER JOIN COUNTRY c ON c.id = nr.custrecord_country Using the above query, I am getting this error: "Search error occurred: Invalid or unsupported search" The tables are related, the custrecord_country field on the customrecord_new_record record is a "Record/List" type that uses the Country record
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you're trying to perform a join operation in a NetSuite saved search or SuiteQL query. However, you're encountering an error because NetSuite doesn't support direct SQL-like joins in saved searches or SuiteQL. In NetSuite, you can only join related records that have a direct relationship. For example, you can join a transaction record with a customer record because there's a direct relationship between them. But you can't join a transaction record with a country record because there's no direct relationship between them. In your case, you're trying to join a custom record (
customrecord_new_record
) with a country record using the
custrecord_country
field. This is not possible because there's no direct relationship between these two records. Instead of using SQL-like joins, you can use the
JOIN
keyword in the
filter
or
column
properties of a search. For example, if you want to get the name of the country related to a custom record, you can do something like this:
Copy code
javascript
var search = N.search.create({
   type: 'customrecord_new_record',
   filters: [
      ['custrecord_country', 'is', 'US']
   ],
   columns: [
      'name',
      'custrecord_country'
   ]
});
In this example,
custrecord_country
is a field on the
customrecord_new_record
record that references a country record. The search will return all custom records where the related country is 'US'. Remember, this is just an example and you might need to adjust it based on your actual requirements and the structure of your data. ****** 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.818951309
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818059683
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816922843
Please provide your feedback on this answer.
Thank you for your feedback