UNKNOWN_EXCEPTION when trying to run an Test class . Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, The record couldn’t be saved because it failed to trigger a flow. unable to find field dataType for complex reference: myVariable

Knowledge Article Number

000233273

Description

UNKNOWN_EXCEPTION Error Occurs when running the Apex Test class:

System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, The record couldn’t be saved because it failed to trigger a flow. unable to find field dataType for complex reference: myVariable_current.FieldName, element: interaction.definition.mdapi.FlowVariable@774a33a, dataType: null Contact your administrator for help.: []

This error may happen when validating an Change set or API deployment .

Resolution

The error might have caused due to Apex Test Class Version .

A possible fix would be below :-Increase the affected Apex Class API Version to 32.0 and above.