<@UM3UMEK3L> that’s a lot of records. But if you d...
# suitescript
k
@Sirus Badiee that’s a lot of records. But if you do get range and only get say 20k records at a time then setup a schedule on the MR and it will keep queuing up to run again. Also try using more processors to run a lot quicker on the map/reduce stage.
s
Yep - Avalara has a custom record created for every time a transaction makes a call to their system. Because we have ~7k SOs put in daily and they mostly have 2-3 Invoices each, that's a looooot of calls. I'm using a search to bring in records, but I need to think of a way I can dynamically use the date in the filter and after each execution, to adjust the date accordingly.
Thanks for the suggestion!
k
Get rid of a lot of previous then run it daily to get rid of every before a month ago using relative date filter.
Build the search in the UI then use the search exporter to get the SS2 code
s
Yeah that's pretty much exactly what I was thinking! Love that friggin search exporter - saved so much time over the last year or so... Just need to figure out a way to update the search criteria automatically. Gonna be tricky, but I think I can do it! Maybe I'll use Internal IDs as some type of filter
k
You won’t need to update the criteria. Use a relative eg 1 month before today
s
Hmmmmm, are you sure? I feel like I would have to for deleting old stuff... New stuff, yeah, I can see that working. But I don't know how I can I can use that to for example run on records from 11/1/18 - 11/2/18 and then on 11/3/18 - 11/4/18 and continue until present day, if that makes any sense
k
No no have one search was has delete everything from before 1 month ago. And use get range to only get say 5000 pages. Then when you queue it up for hourly running for instance it will then keep deleting until there is no results. Then change the running to daily and it will only delete the ones that have a creation date of 1 month ago. You can just leave it running and ignore it forever lol
I’ve done it before but not using date. I’m not at my machine or would send what I have over. If I remember I’ll send over my search and you’ll get the jist. Will be tomorrow though
💎 1
🔥 1
👍 1
✔️ 1
s
Oh wow that sounds AWESOME. Sorry it took me so long to understand, but would love to see the mechanics of that! That sounds super super neat - I appreciate it!
k
No worries. Ping me tomorrow if no messages and I’ll send it over. May forget due to busy day
s
Totally get ya - putting in a reminder for myself in my calenda just in case if I have a busy day as well 🙂 Thanks again!
👍 1
Hey hey - I got some crazy version of the script working... Basically, it reschedules the script until the results of the search are zero - which does work. But unfortunately, I can't just set the date filter and forget about it... If I do that, the script freezes at the getInputData since 20 million rows are returned
k
you will need to limit the amount of results you are returning on your get input.