function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chamil MadusankaChamil Madusanka 

Package installing issue with Approval Process

Hi All,

 

I have successfully created a managed package for my current project. That managed package is included few approval processes in apex classes. There are no any issue in Test coverage. But, when I going to install that package to another organization, it triggered few errors from test classes (These errors never triggered when running test classes in previous org). Following are the issues,

 

1. Apex Classes(01pU0000000QCbP)

test_developmentplanmanagerextension.testSearchDevelopmentPlans()

System.DmlException: Process failed. First exception on row 0; first error:

NO_APPLICABLE_PROCESS, No applicable approval process found.: []

(Talent2o)

 

External entry point

 

2. Apex Classes(01pU0000000QCbO)

test_developmentplanextension.testSearchDevelopmentPlans()

System.DmlException: Process failed. First exception on row 0; first error:

NO_APPLICABLE_PROCESS, No applicable approval process found.: []

(Talent2o)

 

External entry point

 

3. Apex Classes(01pU0000000QCb1) testtrainingplanextention.testgetTPbyId()

System.DmlException: Process failed. First exception on row 0; first error:

NO_APPLICABLE_PROCESS, No applicable approval process found.: []

(Talent2o)

 

External entry point



*******************************************

This is the code segment of approval process which related to the PROBLEM 3.

 

if(emp2.size() > 0)
        {            
            idL.add(emp2[0].User__c);            
            System.Debug('approvalId :: '+approvalId);            
            System.Debug('idL :: '+idL);             
             
            if(tempTP.Status__c == 'New')
            { 
                Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
                req1.setComments('Submitting request for approval.');
                req1.setObjectId(approvalId);
                req1.setNextApproverIds(idL);
                Approval.ProcessResult result = Approval.process(req1); 
            
            
            if(result.isSuccess())
            {
           
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,'Approval Sent');
                ApexPages.addMessage(myMsg);         
            
            }
            }else
            {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'User have not any approver');
            ApexPages.addMessage(myMsg);
           
            }
       }    

 

How can I resolve this problem?

 

Thanks in Advance!