jk121960
jk121960

Reputation: 873

SuiteScript 2 joins and filters

I am working on a suitelet, I have a working version in 1.0 but I need to convert to 2.0 as 1.0 lacks facility. In short, I choose an item, locate assembly items that contain it, I select a checkbox for each assembly I want to modify, I then select an item to replace the original item with. In the 1.0 I had a saved search that joined the item through the "member" sublist, I also pulled in the "line" that it was on. In 2.0 I can't seem to access the joined columns from the search, which I used to filter by the identifier 'memberitem' and pass in the internalid of the item. But for some reason it errors and states that it is "An nlobjSearchFilter contains invalid search criteria: memberitem." This is the column that is available in 1.0 to filter by item. Any help with this is appreciated.

Upvotes: 1

Views: 1368

Answers (1)

w3bguy
w3bguy

Reputation: 2250

Here is a sample of the 2.0 search. Nothing really changed with the columns and filters, so you should be able to just copy those over to the 2.0 search.

search.create({
  type:search.Type.CUSTOMER,
  title:'test Search',
  id:'customsearch_testsearch',
  columns:['internalid','someOtherColumn'],
  filters:['parent','anyof',parentID]
});

Here is the URL to the docs (N/search Module). Hope this helps. Not much more I can do without a sample of the existing code.

On a side note, here is the doc that shows what type of search operators can be used with what types of fields: Search Operators. The field memberitem is a select list, so you can only use anyof or noneof with that field.

Upvotes: 1

Related Questions