What is the proper way to trigger a suitelet to lo...
# suitescript
k
What is the proper way to trigger a suitelet to load a saved search with modified filters? The dropdowns have too many records it's difficult to find statuses to filter with
s
I am a little fuzzy on what you're trying to do, but when you have the search object, you can add filters to it.
k
I can see an example of this from stackoverflow -- but I'm having difficulty actually putting it to use. Can I ask you for a little clarification maybe it will be immediately obvious
I have a saved search - the default dropdown for Order Status lists like 100 statuses and only 5 are actually in use. I want to create a custom search filter with only statuses that are actually being used
s
Grab the user guide from Help>User Guides > SuiteScript 2.0 API -- there's a good description of each object/function.
k
I took some suitescript code, created a record -- when trying to upload, got an error that its suitescript 2 and needs the scripttype. I am not sure what type to even utilize this sort of script as
Once I know what to actually do I think I can figure it out ... but like.. would it be a Suitelet, and I just need N/Search modules and to execute the saved search and change URL in my navbar to point to this scripted URL?
s
there's quite a bit to unpack here.
k
Understood, my apologies
I guess my only real question is - what sort of script record would I need in order to execute and display search results .. so I can hijack the filter objects
s
unfortunately, NetSuite doesn't provide the ability to simply filter an 'Available search Filter' which is what it sounds like you're wanting to do.
k
Yeah 😞 I am looking for a work around as it's a bit clunky when the filter dropdowns have so many useless things to filter to
s
Depending on the number of results in your search (as well) this is quite an undertaking for a first Suitelet..
I'll send you a PM
k
I've created a lot of usereventscripts for transforms, I'm not quite at step 0 - I just dont understand whats the best way to address
Sure
thanks
s
The best advice I can give you is to download Matt's book on the subject of SuiteScript 2.0 Development.. he lays it out really well. https://leanpub.com/netsuitedevelopment
s
Yes Kevin the best way is with a Suitelet using the N/search module to get the data, and the
N/ui/serverWidget
module to add the fields. Your main problem is there isnt a native way to filter the results in your sublist with Netsuite APIs. This is very doable if you deploy a client script to your page and hide lines with jQuery, but you've gone pretty far outside the normal scope of a suitelet for a task that probably will not bring much value.
👍🏼 1
k
Thanks for the clarity Sandii, I understand that this is not an ideal way to do it outside of an exercise to learn a lot about suitescript. I was advised by somebody to create a saved search that returns the live status columns, and set it as a source to a field on transaction, then filter off of that... which seems not ideal but easier at least
s
Yeah it's such a janky workaround for a basic need but that accomplish what you need in a much simpler manner.
👍🏼 2