I am trying to create a test class in order to have code coverage for a batch class doing approval processes escalation, but I am receiving the error from the title. I have used the SkipEntryCondition=true at first, but it's not working. (Just FIY: the entry condition is for the Approval_Status__c to be "Ready for Approval" and the quantity > 1, both condition being met). The user & the process definition exist in the Test Environment. I tested separately this as I was suspecting I need to create them manually here.

I've tried to apply the solutions from other threads as this questions has been asked before, but nothing worked in my case. This is my code:

    private static void setup() {

        User user1 = [SELECT Id FROM User WHERE Name = 'MyUsername'];
        ProcessDefinition procDef = [SELECT Id FROM ProcessDefinition WHERE Name = 'OrderProcessDefinitionV3'];

        Account a = new Account(Name = 'Account Name');
        insert a;

        Order o = new Order
            OwnerId = user1.Id,
            RecordTypeId = '0123L0000005QqxE',
            Type = 'Return Order Ullage',
            Name = 'Order name asasd',
            AccountId = a.Id,
            Case_Quantity__c = 1.0,
            EffectiveDate = Date.today(),
            Status = 'Draft',
            Approval_Status__c = 'Ready for Approval'
        insert o;

        // Create an approval request for the order
        Approval.ProcessSubmitRequest req1 =  new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval.');

        // Submit on behalf of a specific submitter

        // Submit the record to specific process and skip the criteria evaluation

        // Submit the approval request for the order
        Approval.ProcessResult result = Approval.process(req1);

    static void testBehavior() {
        BATCH_EscalateOrderApprovalProcess bc = new BATCH_EscalateOrderApprovalProcess();

1 Answer 1


The solution was to comment this line:


Apparently you don't need to specify the Process Definition anymore.

You must log in to answer this question.

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