Anyone seen this error before "Cannot read propert...
# suitescript
r
Anyone seen this error before "Cannot read property "length" from undefined (INVOCATION_WRAPPER$sys#19)"
b
the stacktrace suggests an internal error
probably caused by not passing a parameter
e
Some more context on when/where this is happening will be useful
r
I have this workflow action script
** * @NApiVersion 2.x * @NScriptType WorkflowActionScript * ryan's workflow intiate working but errors */ define([], require(['N/workflow', 'N/search', 'N/error', 'N/record'],  function(workflow, search, error, record) { function initiateWorkflow()  { var workflowInstanceId = workflow.initiate({ recordType: 'customer', recordId: 1650, workflowId: 'customworkflow_rl_script_test1' }); var customerRecord = record.load({ type: record.Type.CUSTOMER, id: 1650 }); } return {initiateWorkflow: initiateWorkflow} }));
I created a Sales Order and workflow running on SO with this workflow action. Then the error popped up
e
ah, you may need to narrow down which line in your script is showing it; might be tricky to track down
r
Guessing 19?
type: record.Type.CUSTOMER,
b
the 19 is from the internal code, not useful to you
r
@battk ok makes sense
b
you only have 2 lines of code
should be simple to figure out which one it is by removing one
e
Unless the problem is in the workflow being initiated
r
I will remove some lines to see if it fixes it. I will also change the initiating workflow. I just don't even know if what I'm trying to do is possible since the records aren't linked at all
b
you have 2 statements
Copy code
var customerRecord = record.load({
type: record.Type.CUSTOMER,
id: 1650 });
}
Copy code
var workflowInstanceId = workflow.initiate({
recordType: 'customer',
recordId: 1650,
workflowId: 'customworkflow_rl_script_test1'
});
remove the entire statement
and only have 1
r
Thanks @battk I will remove the first statement and see if it works.