How to get a tax code
How can i get tax codes from NetSuite?
Now i have 2 ways to get tax code from NetSuite and these are advantage/disadvantage of each
1/ The first way:
I get all tax code from saleTaxItem list and save in database, with this way, it's easy and fast.
But we must to check, employees/vendors has permission to use it. in result, SalesTaxItem object don't have any property refer to employees/vendors and Employee/Vendor object don't have refer key to SalesTaxItem too.
So, how can i know employee/vendor has permission to use taxcode with this way?
This is structure of SalesTaxItem Object:
2/ The second way:
I get employees list, vendors list. And foreach those lists to
get taxcodes with function getSelectValueResult of NetsuiteService object.
With this way, with each employee/vendor we need call function getSelectValueResult to get taxcodes list of that employee/vendor. Althought we have 10 tax codes, but we need call function 1000 times (if we have 1000 employee/vendor).
Advantage of this way. we can save reference keys [taxcodes, employee], [taxcodes, vendor], it help check employee/vendor has permission to use tax code.
Disadvantage. slow and waste our time, and get duplicate tax code records.
This is structure of GetSelectValueResult Object when call function getSelectValueResult for each employee/vendor
Which one i should to use ?
I think first way is good, but how can i check permission of employee/vendor when use taxcode?Source: stackoverflow.com