how to create joined columns for saved search in s...
# ask-stanley-ai
n
how to create joined columns for saved search in suitescript 2.0
c
AI generated answer (using internal Slack threads):
To create joined columns for a saved search in SuiteScript 2.0, you can follow these steps: 1. First, create a saved search in the NetSuite UI. This will allow you to visually select the fields and join conditions you need. 2. Once you have created the saved search, you can use the NetSuite Saved Search Code Export Chrome extension to export the source code for SuiteScript 2.0. This extension will generate the code for creating the saved search in SuiteScript, including any joined columns. 3. In the exported code, you will see that joined columns are represented as strings with the format 'join_field'. For example, if you have a join from the 'transaction' record to the 'customer' record on the 'entity' field, and you want to get the 'companyname' field from the 'customer' record, the column would be represented as 'customer.companyname'. Here is a sample code snippet for creating a column in a saved search:
Copy code
javascript
var search = require('N/search');
var mySearch = search.create({
   type: "transaction",
   columns: ["customer.companyname"]
});
In this example, 'customer.companyname' is a joined column. The 'customer' part is the join id, and 'companyname' is the field id on the joined record. Remember to replace 'transaction' and 'customer.companyname' with the actual record type and join column you want to use. ****** 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.850418031
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.8420524
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834164798
Please provide your feedback on this answer.