how to get all values of a sublist column
# ask-stanley-ai
t
how to get all values of a sublist column
c
AI generated answer (using internal Slack threads):
To get all values of a sublist column in SuiteScript, you can use the
getSublistValue
method. However, if you want to dynamically get all the column names from the sublist, there isn't a direct method available. One way to achieve this is by using the
request.parameters
object. Here is an example:
Copy code
javascript
var columnNames = request.parameters.custpage_listfields.split('\\u0001');
This will give you an array of column names. You can then iterate over this array to get the values of each column for a specific line:
Copy code
javascript
for (var i = 0; i < columnNames.length; i++) {
    var value = request.getSublistValue({ group: 'sublistName', line: lineIndex, name: columnNames[i] });
    // do something with the value
}
Another approach is to get the columns from the saved search again in POST. In the client script, you can use the
getMachine
method to get the sublist column ids:
Copy code
javascript
var columnIds = getMachine('sublistId').getFormFieldNames();
Please note that these methods might not work in all scenarios and could be considered hacky. ****** 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.827514648
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822174072
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81463623
Please provide your feedback on this answer.