Hi All, I am adding custom address in open sales o...
# suitescript
s
Hi All, I am adding custom address in open sales order soRecord.setValue({ fieldId: 'shipaddresslist', value: -2 }); var subrec = soRecord.getSubrecord({ fieldId: 'shippingaddress' }); subrec.setValue({ fieldId: 'country', value: 'US' }); When i try to get tax it is getting 0 and once order is placed i am able to get tax When i read, Your new subrecord is saved at the time you save the record. is there any way to get tax in open sales order with this custom address Thanks
b
try dynamic mode
s
Yes i am using same var soRecord = record.create({ type: record.Type.SALES_ORDER, isDynamic: true, defaultValues: { customform: 110, entity: customerID } });
b
one of NetSuite's nicest help topics is about address transactions and tax calculations
if you are using SuiteTax, you can use record macros.
s
I have tried with snippet provided in first link but i am getting 0 as response
record = {object}  arguments = {array} length=6 salesOrderRecord = {dynamic record}  shippingAddressSubrecord = {dynamic subrecord}  taxtotal = {number} 0.0
b
suitetax?
s
We are not using SuiteTax
b
Advanced Taxes?
s
We are using Advanced Taxes
b
whats the taxcode and taxrate1 of the line?
s
Do we need to apply taxcode with script? We are not using that line
Let me try with adding tax line in script
b
tax code supplies the tax rate on the line
no tax code no tax
that said, there is a lot of native functionality on automatically determining the tax of the line
if the item line is supposed to be taxable but netsuite is not filling in the tax
then something is wrong with the tax setup
s
Thank you @battk I will check with tax setup
i have checked with tax setup and taxcode applied in line level and tax got calculated but when but now i am getting wrong tax
i placed item which is having default taxcode and when address added then that code is changing in item level
where changed tax unable to get in dynamic mode
any help in this case please
b
still sounds tax setup related
netsuite automatically selects the tax code by a zip code lookup
s
Yes once i keep address then taxcode is getting changed
but i am unable to get updated tax where iam getting previous tax value
iam getting value at last of all operations but still iam unable . can i get any help to receive original tax
b
what does your current code look like
s
let me share the snippet
soRecord.setValue({ fieldId: 'shipaddresslist', value: -2 }); var subrec = soRecord.getSubrecord({ fieldId: 'shippingaddress' }); subrec.setValue({ fieldId: 'country', value: 'US' }); subrec.setValue({ fieldId: 'city', value: '' }); subrec.setValue({ fieldId: 'state', value: '' }); subrec.setValue({ fieldId: 'zip', value: '' }); subrec.setValue({ fieldId: 'addr1', value: '' }); subrec.setValue({ fieldId: 'addr2', value: '' }); subrec.setValue({ fieldId: 'addressee', value: '' }); soRecord.selectNewLine({ sublistId: 'item' }); soRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'item', value: Number(itemsArr[io].internalid) }); soRecord.setCurrentSublistValue('item', 'price', -1); soRecord.setCurrentSublistValue('item', 'rate', itemsArr[io].price); soRecord.setCurrentSublistValue('item', 'amount', itemsArr[io].price); sublistId: 'item', fieldId: 'quantity', value: 1 }); soRecord.commitLine({ sublistId:'item' }); soDetails.soTax = soRecord.getValue({fieldId: 'taxtotal'});
b
are you setting a real address
s
yes
b
what state and zip
s
Arizona 85281
i tried with UI , when i added item it is getting one taxcode and when i add the address then it is getting changed
and i tries with script iam getting previous tax only
b
is this an existing customer with a preferred shipping address?
s
No
Only for that order we are using this address
b
then i dont know what you are describing
there shouldnt be a previous tax code if there is only 1 address
especially if you are setting the address before the items
s
Thankyou @battk