Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
SuiteScript 2.0 Field.getSelectOptions
Has anyone tried to use the Field.getSelectOptions(options)?
SS1.0 Works just fine.
function test (request, response) { var rec = nlapiCreateRecord('customrecord_sub'); var stateField = rec.getField('custrecord_sub_state'); var nlStateOptions = stateField.getSelectOptions(); var stateOptions = {}; for(var s=0; s<nlStateOptions.length; s++){ var id = nlStateOptions[s].getId(); stateOptions[id] = nlStateOptions[s].getText(); } response.write(JSON.stringify(stateOptions)); };SS2.0 gives JS_EXCEPTION: TypeError: Cannot find function getSelectOptions in object Field.
function getStates(){ var rec = record.create({ type: 'customrecord_sub' }); var stateField = rec.getField({ fieldId: 'custrecord_sub_state' }); var stateOptions = stateField.getSelectOptions({}); return {field: stateField, options:stateOptions}; } 0