ANS-0250 · SUITESCRIPT DEVELOPMENT

How to Edit Sublist Fields in NetSuite SuiteScript 2.x When `setSublistValue` Fails?

When `Record.setSublistValue` encounters issues editing a sublist field, utilizing `Record.setCurrentSublistValue` or `CurrentRecord.setCurrentSublistValue` can resolve the problem.

Short answer

When attempting to edit a sublist field in NetSuite SuiteScript 2.x using `Record.setSublistValue` and it appears uneditable, the solution is to employ `Record.setCurrentSublistValue` or `CurrentRecord.setCurrentSublistValue` instead. This alternative method often successfully updates fields that are otherwise resistant to direct modification.

Scenario

Users developing SuiteScript 2.x scripts may encounter situations where certain sublist fields, such as 'porate', do not appear to be editable using the `Record.setSublistValue` function. This can lead to scripts failing to update the intended field values on sublists, despite correct syntax and field IDs.

Solution

When a sublist field cannot be edited using Record.setSublistValue, the recommended approach is to utilize the Record.setCurrentSublistValue or CurrentRecord.setCurrentSublistValue logic instead. This method often successfully updates fields that are otherwise resistant to direct modification. For example, if a field like 'porate' is uneditable with Record.setSublistValue, employing Record.setCurrentSublistValue (or CurrentRecord.setCurrentSublistValue in client scripts) should resolve the issue.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant