+ Start a Discussion
ramesh infyramesh infy 

Test class fail on invocable apex class of process builder

I have written a test on invocable apex class used in process builder and its failed. plz find the below code and help me out where i am going wrong also atteched the error 

Error --
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Account Owner Change” process failed. Give your Salesforce admin these details. <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow.  Please contact your system administrator for more information.: []

code --
@isTest
public class RequestPortalRecordsTest {

    static testMethod void OwnerUpdateMethodTest() {
        Test.startTest();
        Food_Service_Bulk_Data_Processing_Limit__c c=new Food_Service_Bulk_Data_Processing_Limit__c();
        c.Name='Default';
        c.Batch_Size__c=200;
        insert c;
        
          Account acc = new Account();
          acc.Name = 'TestAccount';
         acc.Rating='Active';
       insert acc;
       Request_Portal__c rp = new Request_Portal__c ();
        rp.Account_Name__c = acc.id;
        insert rp;
        //rpList.add(rp);
        List<Request_Portal__c> rpList = new List<Request_Portal__c> ();
        RequestPortalRecords.ReqChange(rpList);
         Test.stopTest();
         //  public static void ReqChange(List<Request_Portal__c> rp)
        
    }
}
Rajesh3699Rajesh3699
Hi Ramesh,

You are not adding the request portal object to the list which you are passing as a parameter to the class "RequestPortalRecords.req(rpList);

Thank You,
Rajesh Adiga P.