Posts

Showing posts from June, 2021
  System DML Exception Exception. : DmlExecutionException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: [] Solution:-  Understand the exception First, check the logs . You can find your errors and resolve them easily in debug logs. Error in my debug logs looks like:- EXCEPTION_THROWN|[555]|System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: [] 1. [555]  - Line number where the error occurred. ( Apex Class) 2.  System.DmlException - Error occurred during DML ( Data Manipulation Language). 3. Insert failed - records are not getting created. 4. INVALID_CROSS_REFERENCE_KEY, invalid cross reference id - I am assigning a wrong id to a field during insertion. (Normally you will get this error whenever you have assigned a wrong id to a field) Also, you can check the variable assignment in your debug logs. VARIABLE_ASSIGNM...