Finnster
Finnster

Reputation: 107

NetSuite SuiteScript Reference Key not being recognized

I am trying to get a script to set a field in a Purchase Order after processing a Sales Order. The field is 'department' and the reference key is 71. However, I am getting the error: "Invalid department reference key 71 for subsidiary "

The code is simple enough:

obj_New_PO.setFieldValue('department', 71);

I am fairly new to NetSuite scripting so I am not sure on this error. I checked the reference keys for 'department' (under Setup -> Company -> Departments) and 71 does exist.

Any ideas as to why the Purchase Order is not seeing the correct reference key?

Thank you.

Upvotes: 0

Views: 5650

Answers (1)

erictgrubaugh
erictgrubaugh

Reputation: 8847

Departments are restricted to specific Subsidiaries. You will need to make sure that the Department in question is available in the PO's Subsidiary. Just view the Subsidiaries field on the Department record.

Upvotes: 2

Related Questions