Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Return Filters and columns for Saved searches? #40

Open
JsbB07 opened this issue Nov 24, 2021 · 7 comments
Open

Return Filters and columns for Saved searches? #40

JsbB07 opened this issue Nov 24, 2021 · 7 comments

Comments

@JsbB07
Copy link

JsbB07 commented Nov 24, 2021

One big hassle to figuring out custom searches is figuring out the names and structure of the json criteria.

Is there a way to have the filters and columns returned with "saved searches" to get how exactly how Netsuite wants to expects the format?

It returns the ones you send during an exception error using "search" but it would be nice to be able to create a search in Netsuite then pull it using "Saved search" to see the filter and column it used. Would save a bunch of trial and error.

Thanks

@cmhobbs
Copy link
Contributor

cmhobbs commented Nov 24, 2021

So you're not left hanging - Acumen Brands closed up shop years ago and this repo hasn't seen any commits in the last 9 years. There are a couple of forks floating around that might still be in active development but this repo should probably be archived.

@JsbB07
Copy link
Author

JsbB07 commented Nov 24, 2021

cmhobbs,

I still use this practically daily for remote netsuite work.

Thanks for letting me know.

@cmhobbs
Copy link
Contributor

cmhobbs commented Nov 24, 2021

Maybe one of the other devs will chime in.

@pigmonkey
Copy link

You can sort of get what you want for the columns in a roundabout way. The relevant SuiteAnswers are 10280 which defines the nlapiSearchRecord function (this is what this library uses to executes searches) and 10274 which defines the nlobjSearchResult object (the nlapiSearchRecord function returns an array of these nlobjSearchResult things).

You can build your saved search in the Netsuite UI, open up your browser console, and then execute that search. Here's how I'd execute a saved transaction search with the ID of 751:

>> r = nlapiSearchRecord('transaction', 751, null, null)

Then you can inspect the columns on the first result:

>> r[0].getAllColumns()
Array(7) [ {…}, {…}, {…}, {…}, {…}, {…}, {…} ]
    0: Object { name: "trandate", type: "date", sortdir: "ASC", … }
    1: Object { name: "tranid", type: "text", sortdir: "ASC", … }
    2: Object { name: "entity", type: "select", index: 3, … }
    3: Object { name: "amount", type: "currency", index: 4, … }
    4: Object { name: "memo", type: "text", index: 5, … }
    5: Object { name: "custbody_internalmemo", type: "clobtext", index: 6, … }
    6: Object { name: "statusref", type: "select", index: 7, … }
    length: 7
    <prototype>: Array []

Those names are what you'd use for the columns when crafting the JSON to rebuild that search in this library.

For filters, you'd use those same column names. The possible operators are all defined in SuiteAnswer 10565.

@JsbB07
Copy link
Author

JsbB07 commented Nov 24, 2021

Pigmonkey:

Thanks! That definitely helps.

@hayden-t
Copy link

have a look at the network graph for my patches , i still run this
https://github.com/acumenbrands/rest_suite/network

@hayden-t
Copy link

I believe my fork has this feature
https://github.com/hayden-t/rest_suite

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants