how do I access a custom lists' value column? I f...
# suitescript
b
how do I access a custom lists' value column? I found from stackoverflow that the abbreviations can be accessed with search.create, but this script errors out when I try to pull the value column:
Copy code
search.create({
    type: 'customlistmxapparelcolors',
    columns: [
      search.createColumn({name: 'abbreviation', label: 'abbreviation'}),
      search.createColumn({name: 'internalid', label: 'internalid'}),
      // search.createColumn({name: 'value', label: 'value'}),
    ]  
});
Thank you for any help!
specifically this "value" column is where I'm trying to pull data from
b
create the search in the ui first, ids dont need to match between searches and records
b
how do I create the search in the ui first? are you saying there's a way I can create a customlist search by going thru Reports -> New Search, and that will lead me to being able to script a solution to get the values column on custom lists?
i have no idea how to create a Saved Search that is of type
customlistmxapparelcolors
?
b
Whats the internal id number of the list
b
customlistmxapparelcolors
, it's a custom list created thru the Matrix Item Assistant, and I had to manually change its id, if that matters at all, but I think a custom list is just a custom list in NS?
b
what the url used to edit the custom list
so 312 is the internal id? i confused it with the id field, my b
b
the internal id is 312
the script id is customlistmxapparelcolors
you probably want to put underscores in the script id
👍 1
you can get there by viewing the list view of your custom list
customizing its view, pressing more options, and having fun with the saved search
the more script related approach is to simply make the
customlistmxapparelcolors
search without any filters or columns, and just save it and then find it in the saved search list in the ui
b
oh wow that's really cool, I wish there was a way to access a custom list without having to save a search thru ui (spent a lot of time experimenting with both
N/search
and
N/query
libraries with no dice), but you have given me something I can at least automate off of, thank you for your genius advice battk!!!
b
you can also load your custom list as a custom record using
customlist
as the type and the internal id as the id
you can also load individual list options with the script id as the type and the internal id of the value as the id
that last option is basically treating the custom list as a custom record where each value represents a record