Generally, the error "cannot read property 'fieldName' of undefined" stems from your JavaScript hook. It's trying to read a property from a field that is not available.
For example:
{
"field1": "value1",
"field2": "value2"
}
Hook code:
var sample = field1.innerField.testField;
The above code generates the error: "cannot read property 'testField' from undefined", because field1.innerField is undefined.