More of a conceptual question: I have a pretty com...
# suitescript
m
More of a conceptual question: I have a pretty complicated saved search with lots of formulas and joins - it generates "right now" data. Best I can tell there is not a(n easy) way to run this search for a defined period or "As Of". My knee jerk solution is to build a custom record, run the search on a schedule, and then reference / trend the "saved results" from the custom record. Any thoughts? Follow up question: assuming that I run into other situations that I use the technique for - do I build the custom record in a way that lets multiple searches save their results there? or use a different custom record for each search? or is there just a better way to approach this whole thing...
b
you may be asking this in the wrong channel. In suitescript you can dynamically add your own filters.
m
Possibly... basically the filter criteria to move it back in time would be difficult if not impossible. Running the search itself is easy. I am thinking of using a scheduled script to run the search then save the results to a custom record - but not sure if I am overlooking some obvious alt solution... recommended channel?
b
what are your filters and columns?
l
If you are looking for snapshot data then creating a custom record based on the search result set is a viable solution.
You the report out based on the custom records.
The last project I built like that was pretty successful. Main issues were missing records if a script failed/search was edited/etc.
And users wanting to "fix" historical data because that isn't what the searches say today.
m
battk - Lots of filters and columns - like I said complicated. Its also looking at entity and transaction data and it is in summary form. I can enumerate in more detail if you think it is valuable...
b
usually you can add a filter on something like the date created for date ranges
m
@lukeabbott I think I can keep it mostly locked down so only they only see the final output. If you had the potential of writing multiple searches would you make multiple custom records?
@battk some of the fields can have their values change over time, so i would have to pull in system notes and then put a limit on that - but since there are multiple sources for the data it gets ... impossible?
l
I used one custom record called a "scorecard". That record had a dozen or so fields each populated by a specific search. The script ran the searches, created a custom record for each result row, and then populated the record fields with the corresponding row from the correct search.
It was very specific to that task, so a new type of custom record would have been needed to do a similar thing with a different search.
m
Okay, that was my original thought. I was also thinking I could just json.stringify the results and save them to a single cell and then parse the cell when I want to do something with the data.
1 search to 1 record is probably safer though...