Which issue, which record?
# suitescript
a
Which issue, which record?
m
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]); var result= rec.save(); return String(result);
this is my PUT script
it always returns 200 but never update the record
a
Make some logs, log context and type of context and see what is in there, you may need to parse the request body as object or something…
s
I don't think that code should work, even though it looks like the example NS provides in help
the code above expects the request payload to be properties on
context
which hopefully isn't how it works
try referencing
context.requestBody
instead. I'm also kinda sad NS put this relatively complicated and broad (can set any field) code as their example