I’m struggling with a Map/Reduce script. I’m getti...
# suitescript
f
I’m struggling with a Map/Reduce script. I’m getting
SSS_INVALID_SRCH_OPERATOR
along with the message
"an nlobjSearchFilter contains an invalid operator or a syntax error: internalid."
This error gets thrown from a function that does not have any search.create and all my searches look fine and does not include
internalid
as a filter. Have anyone experienced this before?
Full error message
{ type: "error.SuiteScriptError", name: "SSS_INVALID_SRCH_OPERATOR", message: "An nlobjSearchFilter contains an invalid operator or a syntax error: internalid.", id: "", stack: [ "Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at createOrder (/SuiteScripts/script.js:433:43)\n at Object.map (/SuiteScripts/script.js:223:35)" ], cause: { type: "internal error", code: "SSS_INVALID_SRCH_OPERATOR", details: "An nlobjSearchFilter contains an invalid operator or a syntax error: internalid.", userEvent: null, stackTrace: [ "Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at createOrder (/SuiteScripts/script.js:433:43)\n at Object.map (/SuiteScripts/script.js:223:35)" ], notifyOff: false }, notifyOff: false, userFacing: true }
n
What does your code look like?
f
The below function is where I experience the issue. createOrderLines() is just a function that sets the sublist values
Copy code
function createOrder(inputData) {
    let savedId = 0
    log.debug('creating...', inputData)

    try {
        const newSalesOrderRecord = record.create({
            type: record.Type.SALES_ORDER,
            isDynamic: true,
        })
        newSalesOrderRecord.setValue({
            fieldId: 'custbody_special_order_id',
            value: inputData.custrecord_special_order_id
        })
        newSalesOrderRecord.setValue({
            fieldId: 'orderstatus',
            value: 'A'
        })
        newSalesOrderRecord.setValue({
            fieldId: 'entity',
            value: inputData.custrecord_entity_id
        })
        newSalesOrderRecord.setValue({
            fieldId: 'trandate',
            value: new Date()
        })
        newSalesOrderRecord.setValue({
            fieldId: 'custbody_trx_markning',
            value: '9'
        })
        newSalesOrderRecord.setValue({
            fieldId: 'custbody_material_ansvarig',
            value: '14126'
        })

        // Add Lines
        const lineStatus = createOrderLines(newSalesOrderRecord)

        log.debug('newSalesOrderRecord', newSalesOrderRecord)

        // Save order
        savedId = newSalesOrderRecord.save({
            enableSourcing: false,
            ignoreMandatoryFields: true
        })
        log.debug('savedId', savedId)

    } catch (error) {
        log.debug('errormsg', error)
        writeStatusMessage({
            recordId: inputData.internalid.value,
            valid: false,
            validationMessage: ' - CREATE ORDER ERROR: ' + error.message
        })
    }
    return savedId
}
It stops running on newSalesOrderRecord.save()
l
Hi Felix, review the User Event scripts deployed to Sales Order record, most likely the error will be on Execution Log of the script
f
But I the error I sent is from the Map/Reduce execution log? Can it really be another script causing the error?
b
yes, user event scripts will be triggered on save in a map/reduce
f
I would just assume the execution log to tell me more about what script it is
j
hahah nah NS is not that helpful
Two things to start your investigation: check your overall Script Execution Logs for all scripts under Customization -> Scripting -> Script Execution Logs
and check Customization -> Scripting -> Scripted Records to see what’s deployed against your record type
s
If a script triggers another UE script on saving a record, then any errors that second script causes will be logged as errors in the save of the first.
1