I am getting an error when trying to do a validation on a changeset on production. The error that I receive is as below.

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. A flow trigger failed to execute the flow with version ID 301440009000Pvmc. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: [] Stack Trace: Class.AutoUpdateTeam_Test.testpartTeamUpdate: line 178, column 1

The code on that line 178 is to insert record

    list<Part__c> partList = new list<Part__c> ();
    Part__c part9 = new Part__c();
    part9.Opportunity__c = opp.id;
    part9.Product__c = product.id;        
    part9.ASP__c = '345';
    part9.Stage__c = 'Design Lost';
    part9.Reason_Design_Closed__c = 'Lost/Price';
    part9.Part_Probability__c = 20;        
    part9.name = 'Test Part';

    insert partList

Is there a way to check what is causing this error? I checked on debug logs by enabling and was not able to track it. How can I know the exact reason for this error?

  • Can you reproduce the error in the UI, without running a test? Those usually come with an email that includes (slightly) more helpful details.
    – David Reed
    Jan 24, 2018 at 1:28
  • I checked for any logs/errors by email, but don't see any yet. I am running as myself and emails all looks good. Is that because this is a validation call?
    – Gops
    Jan 24, 2018 at 1:30
  • Do you need the flow for your test? It is possible to disable triggers, which I think is what you will want in this case.
    – Aequitas
    Jan 24, 2018 at 2:16

2 Answers 2


I'm guessing that the problem is happening because you are trying to start a flow on the trigger and for some reason the flow is failing.

You could try and fix it so the flow works or as an alternative if your test is not dependent on the flow then you can try just disabling triggers in your test with this line of code before the insert: fflib_SObjectDomain.getTriggerEvent(YOURCLASSNAME.class).disableAll();

  • 1
    I don't see any indication fflib is involved here. Why wouldn't a flow be accessible in test context? Flows are metadata.
    – David Reed
    Jan 24, 2018 at 3:32
  • @DavidReed I've done very little with flows so don't really know anything about them. But I stand by my answer in the case that the test does not depend on the flow. If the test is specifically testing that the trigger/flow does something, then this will not help.
    – Aequitas
    Jan 24, 2018 at 3:50
  • Sorry, I am new to this so, Is the fflib_SobjectDomain a seperate class that we need to write? Or this is something that exists already in Salesforce? Today I was able to get some error emails and it seems be coming from flows.
    – Gops
    Jan 24, 2018 at 17:27
  • @Gopi it's an existing class for trigger handling which you can install and use. Check your trigger class to see if you are using it.
    – Aequitas
    Jan 24, 2018 at 22:48

Odds are, your unit test doesn't set up data correctly. For example, you can get errors when a parent record is checked for some value, but the lookup field is null. There's not one specific reason why this happens, but instead may be any of a number of things. You'll need to examine the flow to see what data it needs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .