We have a UE script that does logic for amortizati...
# defects
t
We have a UE script that does logic for amortization schedules. Since these details are only available after the record is saved we need to reload the record in an aftersubmit. Its not efficient or nice but its how things need to be done here otherwise the values we need aren't populated yet. Only issue is that NetSuite isn't giving the right id in the script context object. When we try to reload the record it just saved it gives us an error saying the record it just saved doesn't exist. If you look at my screenshot then you'll see the top log on the left details there is an error on line 80 and in the code its reloading the record it just created. If you are curious, the id is simply off. If the id is 27469 in the logs / code, we'll find its actually 27470 in the UI and that 27469 doesn't exist TLDR; Netsuite scriptcontext.newRecord.id is giving us an incorrect value that is different from what is created in the UI and throws an error
k
Have you considered switching to a map/reduce or scheduled script to do the work instead? Will improve load times and might solve this problem by allowing you to get the right value after it's been saved.
So have a user event that calls the map/reduce or scheduled script to operate against current record and find the attached amortization schedule
The reason I'm suggesting this is that your amortization schedules are line level - so I'm guessing you have to loop through the record after it's been submitted. You may be running into a minor order of operations issue where you're trying to access the data before it really exists.
t
I have considered this and most likely we will have to go that route. To your point of the "order of operations", Netsuite should resolve all those issues and all dust should be settled by the time an aftersubmit comes around. That's the point of that event type