`400 Bad Request: This request is missing a requir...
# suitescript
j
400 Bad Request: This request is missing a required parameter.
Does anyone know what can wrong for upsert using suitescript 2.0? I passed the record type and id
Copy code
function put(context) {
    doValidation([context.recordtype, context.id], ['recordtype', 'id'], 'PUT');
    var rec = record.load({
        type: context.recordtype,
        id: context.id
    });
    for (var fldName in context)
        if (context.hasOwnProperty(fldName))
            if (fldName !== 'recordtype' && fldName !== 'id')
                rec.setValue(fldName, context[fldName]);
    rec.save();
    return JSON.stringify(rec);
}
b
Looks url related, what url are you making requests to
j
Solved,
put
use requestBody instead of requestParams like
get
, thanks @battk