has anyone created a search filter using script's ...
# suitescript
h
has anyone created a search filter using script's parameter before? I created a search in my script which is filtered by posting period, but the user wants the ability to change the period in the UI instead of going in manually change the posting period inside the script
c
Yeah you just make a script parameter and use it w/ the N/runtime module to snag the parameters and then use those in your search filters
h
perfect, thanks i think i got it
i got an error saying "invalid search filter", but i'm not sure what's wrong with this one. Could you please advise?
defaultFilters.push(search.createFilter({ name: "revenueplan.postingperiod", operator: "anyof", values: postingPeriodParam }));
k
Your parameter uses the period listing?
As opposed to free form text?
h
it uses type Integer Number
i'm not seeing period listing as type
r
Shouldnt this
Copy code
defaultFilters.push(search.createFilter({
               name: "revenueplan.postingperiod",
               operator: "anyof",
               values: postingPeriodParam
           }));
be this
Copy code
defaultFilters.push(search.createFilter({
               name: "postingperiod",
               join: "revenueplan",
               operator: "anyof",
               values: postingPeriodParam
           }));
h
yup that was it, thanks