Tuesday, January 29, 2019

Scripting > Setting a select field using nlapiSetFieldText examples

API: nlapiSetFieldText(fldname, txt, firefieldchanged, synchronous)
Use nlapiSetFieldText to set the select field on the current record using the UI display name
Note: This function is available in client and user event scripts only

Example 1: Setting status of Event (calendarevent) to 'Tentative'
Status UI display names:
'Canceled'
'Completed'
'Confirmed'
'Tentative'
Code:
nlapiSetFieldText('status', 'Tentative');

Example 2: Setting status of Sales Order (salesorder) to 'Pending Fulfillment'
Status UI display names:
'Pending Approval'
'Pending Fulfillment'
Code:
nlapiSetFieldText('orderstatus', 'Pending Fulfillment');

Example 3: Setting the priority of a Case (supportcase) to 'Low'
Priority UI display names:
'High'
'Medium'
'Low'
Code:
nlapiSetFieldText('priority', 'Low');

Note: For more information about Fields APIs including nlapiSetFieldText, please refer to the SuiteScript Developer and Reference Guide under Help > User Guides > 'SuiteScript Developer and Reference Guide'

No comments:

Post a Comment