This is a weird one. I'm trying to update the Proj...
# suitescript
m
This is a weird one. I'm trying to update the Project (id: job) field on a sales order form. When I look at field help I can see the following selections are valid IDs for that field (see screenshot below): 4862209 4682210 So I did a record.submitFields():
record.submitFields({type: record.Type.SALES_ORDER, id: 5153500, values: {job: 4682210}});
But the debugger returns an error:
Copy code
{"type":"error.SuiteScriptError","name":"INVALID_KEY_OR_REF","message":"Invalid job reference key 4682210 for entity 4862208.","id":"","stack":["createError(N/error.js)","<anonymous>(adhoc$-1$debugger.user:7)","<anonymous>(adhoc$-1$debugger.user:5)"],"cause":{"type":"internal error","code":"INVALID_KEY_OR_REF","details":"Invalid job reference key 4682210 for entity 4862208.","userEvent":null,"stackTrace":["createError(N/error.js)","<anonymous>(adhoc$-1$debugger.user:7)","<anonymous>(adhoc$-1$debugger.user:5)"],"notifyOff":false},"notifyOff":false,"userFacing":false}; ID:
Just for the heck of it I've tried sending both IDs as both numbers and strings. Same result. Can't understand why the filtering would be different through script than through the UI.
m
My dyslexia misbehaves, but you code shows 4682210, and the field help has 4862210… your id has a typo
m
Oh geeze. Let me take a look. I need to sleep more. Thank you.
m
6 and 8 got switched
No worries, i’ve spent 12 troblushoot a script judt to find i had a similar typo
m
Sure enough. Worked. Thank you so much.