SSS_MISSING_REQD_ARGUMENT error

I have below query: and I deployed it in my Netsuite. But I have below error message which I don’t know how to fix it.

    “error”: {
        “code”: “SSS_MISSING_REQD_ARGUMENT”,
        “message”: “{\”type\”:\”error.SuiteScriptError\”,\”name\”:\”SSS_MISSING_REQD_ARGUMENT\”,\”message\”:\”createQuery: Missing a required argument: type\”,\”id\”:null,\”stack\”:[\”Error\”,\”    at Object.get (/SuiteScripts/…)\”],\”cause\”:{\”name\”:\”SSS_MISSING_REQD_ARGUMENT\”,\”message\”:\”createQuery: Missing a required argument: type\”},\”notifyOff\”:false,\”userFacing\”:true}”
    }
I set an parameter ‘createQuery.type’ and gave it ’employee’ value. Still not running.
Any idea please?

/**
* @NApiVersion 2.1
* @NScriptType RESTlet
*/
define([‘N/scriptTypes/restlet’, ‘N/query’],
function(restlet, query) {

// RESTlet entry point
const get = function (requestParams) {
// Create Employee query
const qObj = query.create({
type: query.Type.EMPLOYEE
});
// Set query condition for the Supervisor field on the employee record, it should not be empty
qObj.condition = qObj.createCondition({
fieldId: ‘supervisor’,
operator: query.Operator.EMPTY_NOT
});
// Add supervisor value in the query results
qObj.columns = [qObj.createColumn({
fieldId: ‘supervisor’
})]

const returnArray = [];

// Retrieve the results
const results = qObj.run().results;
for (var i = results.length – 1; i >= 0; i–) {
const obj = results[i];
returnArray.push(obj.values[0]);
}

// Create a RESTlet custom response to set the Content-Type header to JSON object
const response = restlet.createResponse({
content: JSON.stringify(returnArray),
contentType: ‘application/json’
});

log.debug(‘response’, JSON.stringify(response))

return response;
}

return { get };
});

Rookie Asked on September 16, 2024 in SuiteScript.
Add Comment
1 Answer(s)

`query.create({type: query.Type.EMPLOYEE});` that code snippet works for me. I’d try adding a NEW log message right before you call query.create() to validate your script in NetSuite is actually being updated – maybe an old version of the script is still being run in NetSuite.

 

Rookie Answered on September 16, 2024.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   SuiteMigration   Become a Sponsor