on a new sales order, if I select a custom shippin...
# suitescript
b
on a new sales order, if I select a custom shipping address, I get the pop-up window. If I fill it in, and save, then NetSuite automatically updates the taxcode on all the existing lines, based on the new shipping address. but if instead, I use client script to set the custom address, then NetSuite ignores it, and continues to use the old tax code, even when I save the record. How do I force NetSuite to "realize" the taxcode needs to be updated based on my new custom shipping address?
b
can you use the 'ignoreFieldChange' == false property maybe?
as I remember there is another similar client script property
similar to 'ignoreFieldChange'
b
fireslavingsync
i have to use ignoreFieldChange: true, else the pop-up window comes up
a
none of these are great ideas, which means you should probably be looking at doing something fundamentally different instead. 1. don't use custom option, instead create a new address subrecord and attach it to the customer and then select it? 2. you can try calling NS's recalc function manually in your client script, which I think is literally what you're asking for, but this seems pretty far from best practices
Item_Machine_Recalc(false);
b
option 2 didn't work either
I tried just doing it from the console
my suspicion is that when the custom address pop-up is closed, it calls a function on the opener window. i just don't know what that function is
a
sorry I gotta ask, where are you getting the shipping address data from, such that it makes sense to be auto-entering it from a client script context?!
b
You might also try recObj.commitLine call as well. On every line item
👍 1
To recommit the lines and force native NetSuite to recalculate tax
One option to consider
b
you will probably have better luck using suitescript 1 for this purpose
it explicitly allows you to commit the shipping address
technically you can commit the subrecord in ss2, its just not explicitly supported
although ss2 explicitly states it doesnt support editing subrecords in client scripts anyways, so you are already in the unsupported territory here
b
thank you for that clever idea. i will try it