ANS-1813 · WEB SERVICES & INTEGRATIONS

How to Enable Writable Inline Fields in NetSuite Web Services

A user event script can modify field display types to allow data entry via SuiteScript 2.x when interacting with NetSuite through web services.

Short answer

To enable writing to inline, disabled, or hidden fields via web services, implement a beforeLoad user event script. This script checks if the execution context is 'webservices' and, if so, updates the display type of specified fields to serverWidget.FieldDisplayType.NORMAL, making them writable for programmatic interactions.

Scenario

When integrating with NetSuite via web services, certain fields that are typically displayed as inline, disabled, or hidden on standard forms may not be writable. This limitation can prevent external systems from programmatically updating these specific fields, hindering data synchronization and integration efforts.

Solution

To enable fields that are typically unwritable (inline, disabled, or hidden) to be modified via web services, implement a User Event script configured to run beforeLoad. This script will check the current execution context and, if it is 'webservices', will update the display type of the target fields to 'normal', making them accessible for programmatic updates. The following SuiteScript 2.x example demonstrates this approach:

javascript/** * @NApiVersion 2.x * @NScriptType UserEventScript */define(['N/runtime', 'N/ui/serverWidget'], function(runtime, serverWidget) { function beforeLoad(scriptContext) { var form = scriptContext.form; if (runtime.executionContext === runtime.ContextType.WEBSERVICES) { form.getField('custcol_origin_state_v2').updateDisplayType({ displayType: serverWidget.FieldDisplayType.NORMAL }); form.getField('custcol_origin_city_v2').updateDisplayType({ displayType: serverWidget.FieldDisplayType.NORMAL }); form.getField('custcol_destination_state_v2').updateDisplayType({ displayType: serverWidget.FieldDisplayType.NORMAL }); form.getField('custcol_destination_city_v2').updateDisplayType({ displayType: serverWidget.FieldDisplayType.NORMAL }); } } return { beforeLoad: beforeLoad };});

This script should be deployed to the record type containing the fields custcol_origin_state_v2, custcol_origin_city_v2, custcol_destination_state_v2, and custcol_destination_city_v2.

Expert NetSuite Support

Need help with this NetSuite issue?

Web Services & Integrations consulting and configuration support

Talk to a consultant