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.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
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