I need a script field/parameter that can hold mult...
# ask-stanley-ai
s
I need a script field/parameter that can hold multiple internal ids for a custom form, what would be the best way to implement this?
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** Based on the conversations, it seems that NetSuite does not currently support multi-select script parameters or fields. However, there are a few workarounds you can consider: 1. Comma-separated list of internal IDs: This is a common approach where you store the internal IDs as a comma-separated list in a text field. This method is simple but may not be the most elegant solution. 2. JSON array in a text field: Another approach is to store the internal IDs in a JSON array within a text field. This method provides a structured way to store multiple IDs. 3. Custom record: You can create a custom record that holds your multi-select and other fields, and have your script parameter reference that. 4. Saved Search: You can create a saved search that defines the set of internal IDs you want, and link your script parameter to this saved search. Here is a code snippet that was shared in the conversation for getting custom fields:
Copy code
javascript
require(['N/query'], query => {
  const myQuery = query.create({
    type: query.Type.CUSTOM_FIELD
  });
  
  myQuery.columns = [
    myQuery.createColumn({
      fieldId: 'internalid'
    }),
    myQuery.createColumn({
      fieldId: 'scriptid'
    })
  ];
  
  const resultSet = myQuery.run();
  console.log(resultSet.asMappedResults());
});
Remember, these are workarounds and may not be the most efficient or elegant solutions. Always consider the specific requirements and constraints of your project when choosing a solution.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839751542
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839053214
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834992647
Please provide your feedback on this answer.