<@U017Q34GFPV> absolutely! It can be done in all ...
# suitescript
s
@Bibek Shrestha absolutely! It can be done in all versions of SuiteScript. In 2.0 and 2.1, you would use the
N/search
module to load or create, then run, any saved search
👍 1
b
Great! Thanks for the quick response.
@scottvonduhn A follow up question: Would you happen to know a condition where the search gets loaded but the result set has no rows? I was able to pull in two saved searches but the third one doesn’t have results. It does have results in the UI though.
s
Not sure. what type of search is it? Transaction? Custom record type?
b
It is Transaction search
I logged the search.filters property and it does show the criteria used by the saved search
do I have to add the type property when loading the search for this case?
s
Well, usually you would further filter Transaction searches by type, unless you want every transaction type to be returned (that could be a lot of data)
You can target specific transaction subtypes, such as search.Type.INVOICE, for example, if that is really the only transaction type you need
when loading a search defined in the UI, usually you only need the id though
b
ya.. I’m loading a saved search created from the UI the search does load.. but with zero results.. and I don’t see any reason why that is
m
Could it be role related? Script running under a different role to UI user?
b
The saved search is public. Does it still matter which user runs the search using script?
m
The script might not have access to the specific records the search is looking for
b
yup.. that was the issue.. I updated the permission and now I get the results. Thanks a lot
👍 1