Or perhaps it's because the records I'm trying wit...
# suitescript
t
Or perhaps it's because the records I'm trying with aren't in dynamic mode?
c
Copy code
/**
     *
     * @param {object} rec - NetSuite record
     * @param {string} fieldName
     * @param {string} fieldText
     */
    function setFieldSelectOption(rec, fieldName, fieldText){

        var field = rec.getField({
            fieldId: fieldName
        });

        if (!field){

            throw error.create({
                name: '10311',
                message: 'No record field called [' + fieldName + ']'
            });
        }

        /**
         * @type {object[]} options
         */
        var options = field.getSelectOptions({
            filter: fieldText,
            operator: 'is'
        });

        if (!options || options.length === 0){

            throw error.create({
                name: '10312',
                message: 'No field option with text [' + fieldText + '] on field called [' + fieldName + ']'
            });
        }

        log.debug({
            title: 'utils.setFieldSelectOption',
            details: options
        });

        if (options.length > 1){

            throw error.create({
                name: '10313',
                message: 'More than one field option with text [' + fieldText + '] on field called [' + fieldName + ']'
            });
        }

        var internalId = options[0].value;

        log.debug({
            title: 'utils.setFieldSelectOption',
            details: 'Set field [' + fieldName + '] to [' + internalId + ']'
        });

        rec.setValue({
            fieldId: fieldName,
            value: internalId
        });
    }
That might help you
It takes a record instance, the id of a select field on the record and the text value of one of the options on the field