Hello,
We are trying to create an automated scheduled way to "close" waves that are released and not in progress already. Anything where Wave is Released and Pick Task is Ready - we want to mark the Pick Task "Done" which should effectively close the Wave.
According to some of the help docs we should be able to do this with a scheduled work flow but the "status" field is not available in the Set Field Value action.
I am trying to write a script but just doing a simple test in the Script Debugger, I'm getting the following error:
{"type":"error.SuiteScriptError","name":"INVALID_KEY_OR_REF","message":"Invalid status reference key DONE.","id":"","stack":["createError(N/error.js)","<anonymous>(adhoc$-1$debugger.user:18)","<anonymous>(adhoc$-1$debugger.user:5)"],"cause":{"type":"internal error","code":"INVALID_KEY_OR_REF","details":"Invalid status reference key DONE.","userEvent":null,"stackTrace":["createError(N/error.js)","<anonymous>(adhoc$-1$debugger.user:18)","<anonymous>(adhoc$-1$debugger.user:5)"],"notifyOff":false},"notifyOff":false,"userFacing":false}; ID:
My code:
require(['N/record', 'N/search', 'N/log'], function(record, search, log) {
var taskId = '158540';
var pickTask = record.load({
type: record.Type.PICK_TASK,
id: taskId,
isDynamic: true
});
var fieldValue = pickTask.getValue({fieldId: 'status'});
log.debug(fieldValue);
record.submitFields({
type: 'picktask',
id: taskId,
values: {
'status': 'DONE'
},
options: { enableSourcing: false, ignoreMandatoryFields: true }
});
}):
My log message shows "READY" for the current status value.
I have tried setting to 'DONE', 'Done', '3', 3, 'A' — thought there might be some internal ID associated with the status, but basically get the same error each time.
Any suggestions for how to update the Pick Task Status here?
Thank you!
Judy