Anyone with experience with Portugal Localization?...
# suitescript
f
Anyone with experience with Portugal Localization? There’s a custpage field that I seem to be unable to set with SuiteScript. The field is a select and should have one option. Which is value: 1 or text: ‘FT01’. I’ve tried to do both setValue and setText, but I get the same error whatever I try. The logging reads ‘FT01’ when using setText and getText, though when I use setValue and getText it will print out 1, which indicates that there’s something not really working.
Copy code
function setPortugueseIdentifier(data: SpecificsData): void {

    const request = data.request as Invoice
    if (!request.customform) { return }
    // data.rec.setValue({ fieldId: 'custpage_ptl_document_series_selection', value: 1 }) // 1: FT01
    data.rec.setText({ fieldId: 'custbody_ptl_document_series_selection', text: 'FT01' })
    const identifier = data.rec.getText({ fieldId: 'custbody_ptl_document_series_selection' })
    log.debug('identifier', identifier)

}
Copy code
"name": "PTL_ERROR",
    "message": "This transaction can't be saved because the document series identifier is missing or the selected document series identifier is invalid.<br>The document series identifier is rendered invalid if it was recently inactivated or deleted, or its properties (for example, start and end dates) were edited before you saved this transaction.<br>Go to the Portugal Transaction subtab to edit the <b>Document Series Identifier</b> list and save the transaction again."
b
try using Field.getSelectOptions to see the options
f
Thanks. Seems like the field is there, but somehow isn’t
Copy code
const identifierField = data.rec.getField({ fieldId: 'custpage_ptl_document_series_selection' })
const identifierFieldOptions = identifierField.getSelectOptions()
log.debug('identifierFieldOptions', identifierFieldOptions)
Cannot read property 'getSelectOptions' of null
b
doesnt sound like you have a field
in which case the user event that is creating the field is not running for your script