Scenario
While creating a Transaction record via SuiteScript, user encounters the error "Invalid item reference key X for subsidiary Y".
Solution
There are several possible causes why the error "Invalid item reference key X for subsidiary Y" is encountered.
- The internal IDs of either the item or the subsidiary is incorrect.
- User can check the internal IDs by loading each record in the browser console and checking the URL. It will be the value for parameter "id".
- The item the user is trying to add is set to Inactive.
- To check, go to the Item record by navigating to Lists > Accounting > Items and uncheck the INACTIVE checkbox.
- The subsidiary is not selected for the item.
- To check, go to the Item record by navigating to Lists > Accounting > Items. Under the Subsidiary field, check if the subsidiary identified in the script is in the list.
- There is an Item Filter set in the Custom Form, and it filters out the item being set.
- To check, go to the Custom Form being used by the transaction you are creating. Then under the Screen Fields tab > Columns subtab, see if there is a selected value for Item Filter.