I had this problem where I was attempting to add a new Noninventory for Resale item. The code ran without errors, but the item never showed up. That’s where it got weird.
Code that doesn’t work and doesn’t throw errors is a pain. After beating my head against the wall for more than an hour, I contacted NetSuite support. They gave me great insight into finding the problem. Nonetheless, this really needs to be on their enhancement list. Here is the workaround. Oh… and here is the elusive working example in SuiteScript 2.0 that successfully adds an item.
First, the workaround. On the statement that saves the item, single step into it.
It throws an error, which is actually caught and overlooked. In that error in Dev Tools, read the error message (e.message). That error, which is never reported is the key to your issue. It will say something like:
- Income account it missing
- Expense account is missing
- Tax Schedule is missing
Any required field (which is partially controllable by your NetSuite Admins) may show up in this list. If any of them is missing, no error and no new item!
Here is my working example. This example, combined with the debugging technique I gave you above might save you lots of frustration and wasted time.
()h… one more thing. I’ve also included an example of how to set base price on an item. This was also a little tricky.