Is it possible to perform a record.submitFields(),...
# suitescript
d
Is it possible to perform a record.submitFields(), but not have it run any User Event scripts associated with the record?
a
not easily, you can't pass a parameter to say don't trigger user events
trying to think of a use-case where you'd want to do this? There's probably a better approach to be honest
d
So the user events have to look for the specific change I'm making and bypass them logically, is my assumption? 😬
Well I want to run a script monthly that looks at all of our items and updates a single field on them. However, this will take forever, because I have some logic that gets evaluated each time an item record is saved. In this case, all of that logic is irrelevant, since I just need to update that single field.
a
right so now you've gotta go change every UE on every potentially affected record... and any future ones... and also the bundle ones, which will be locked and you can't edit
d
127k+ items that need to get updated. The user event scripts add an extra 5-7 seconds per record.
a
umm do it at 3am?
with a MapReduce that uses concurrency to do more than 1 at a time
d
Gotcha. I'll do a dry run and see how long this takes.
Ya, I've got it in a MapReduce right now. Even at 3am though...127k+ records may take a couple days.
a
no way
I've worked in accounts with >1mil items, you'll be fine
eh, i guess it depends how much concurrency you have
d
Ya, we're on the basic tier. No SuiteCloud+ or anything
a
hmm you should just grab 1 page of search results, so 1k items and then time how long that takes, and extrapolate from there... if you do less than 1k you're timing will be too high cos there's fixed time costs to starting up an MR and doing the search. with bigger datasets that fixed time gets amortized over a bunch of records and the avg time comes down a lot
let me now how it goes if you do need to eek out extra performance there's some tricks you can try 🙂
d
could you do it via CSV import with scripts turned off?
b
you can try using the undocumented
disableTriggers
parameter
👀 2
dont expect to build something serious on an undocumented feature
d
I'll be testing out some things tonight. I'm currently just gathering data on the 127k items and it's going to take about 30 min to see which items need to be changed. We are currently updating through CSV, but it clogs up our queue. We need the queue open during the day, since our warehouse does cycle counts and we can't hold it up.
👍 1
@battk I will give that a try with a sample dataset. Thanks for the tip! Will it throw an error if I throw that option in there and NetSuite takes it away?
b
try it out on a single record first so you can see
d
I'll have a better idea of everything tomorrow. I think once we do the first pass, much of the item data won't need to be updated, but I'd still imagine we can hit 20k items that need to be updated. Basically we're looking at TTM cogs and updating a field based on that. Items should only be updated if there is a big swing in sales.