You need to sign in to do that
Don't have an account?
Michelle Soto
System.DmlException: Failed to insert. First exception in row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER
I want to past the apex class test but when i validate the test class appear the next error:
The flow “Caso nuevo” send a email alert. I think that the problem is the email of the contact, but in the test class i put the email in the contact.
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because there was an error in the process “Caso nuevo”. Provide these details to your administrator Salesforce. null null : [] Stack Trace: Class.ActualizacionResolucionGeneralGarantiasT.actualizar: line 31, column 1
The flow “Caso nuevo” send a email alert. I think that the problem is the email of the contact, but in the test class i put the email in the contact.
@isTest public class ActualizacionResolucionGeneralGarantiasT { @isTest static void actualizar(){ ActualizacionResolucionGeneralGarantias actualizacion = new ActualizacionResolucionGeneralGarantias(); Account cuenta = new Account( Name = 'Test Account' ); insert cuenta; Contact contacto = new Contact( FirstName = 'User', LastName = 'Test', AccountId = cuenta.Id, Email = 'test@gmail.com' ); insert contacto; case numeroCaso = new case( Subject = 'Test NO MOVER', AccountId = cuenta.Id, Dispositivo_Accesorio__c = 'ABC', Status = 'New', Priority = 'Low', ContactId = contacto.Id, Lista_de_dispositivos__c = 'Test NO MOVER', Origin = 'Phone', Dispositivos__c = '', Responsable__c = '0056g000005ixDtAAI', Producto_reportado__c = 'GO', Incidente_reportado__c = 'Otro' ); insert numeroCaso; } }Thanks!
You should remove steps from test class, that's you are using in FLow criteria, i mean due to Insert of numeroCaso, your folw should not be execute
For Example:- suppose in flow you are using criteria Priority = 'Low' then you should not use in Test class
Priority = 'Low'
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
All Answers
Hi Michelle,
On what condition your FLow trigger the emails ?
Thanks,
Priya Ranjan
You should remove steps from test class, that's you are using in FLow criteria, i mean due to Insert of numeroCaso, your folw should not be execute
For Example:- suppose in flow you are using criteria Priority = 'Low' then you should not use in Test class
Priority = 'Low'
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
The issue is solved by changing the origin of the case, since depending the origin the flow run.