[SalesForce] Approval process and entry criteria

I have 2 approval processes on an object and the record in context when submitting had

name = "test", gender = "female"

Important: numberoflocations (one of the criteria in the entry criteria) is a formula field and it ended up as a divide by 0 error and the approval process halted (I guess)and threw an exception message.

Workflow or Approval Process Formula Error The formula in the
"Approval process 1" rule or process is invalid due to the following:
java.lang.ArithmeticException: Division undefined

Click here to return to the previous page.

Coming to the approval processes:

Process order = 1
Approval process 1 entry criteria
AND (name = "test", gender = male, numberoflocations <= "10") 

Process order = 2
Approval process 2 entry criteria
AND (name= "test", gender =female , numberoflocations > "10")

My questions:

Why did the process continue into Approval process 1 even though the gender was female?

Assuming process order mattered and it stepped into the first process, does the process not quit as soon as it encounters the first false condition in the approval process criteria?

Does it step through all the conditions in the entry criteria and finally evaluates if the process is valid for the transaction?

Best Answer

Why did the process continue into Approval process 1 even though the gender was female?

Ans: Approval process runs based on the defined process orders.

So, first it will enter process order 1 and then checks if criteria is matching for which it has been submitted.

It that criteria is not matched then it moves to Process order 2 and again checks the matching criteria for which it has been submitted.

In any of the above executions, criteria matched then it will process for approval, otherwise system will throw the error "unable to submit for approval."

Assuming process order mattered and it stepped into the first process, does the process not quit as soon as it encounters the first false condition in the approval process criteria?

Ans: You have defined the criteria with AND condition.

Returns a TRUE response if all values are true; returns a FALSE response if one or more values are false. Use this function as an alternative to the operator && (AND).

AND (name = "test", gender = male, numberoflocations <= "10") 

Now, the issue you are facing is during loading of formula field it is giving runtime exception due to divide by 0 error thats why entire process got halt.

In that situation, system doesn't even process for evaluating the criteria.

Workaround

Change the formula field value such a way that it will never give you division by 0 error. i.e. check divisor > 0 before dividing in this formula.

Does it step through all the conditions in the entry criteria and finally evaluates if the process is valid for the transaction?

Yes, it is. I have already given the answer in 1st question.