1

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?

5
+50

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.

  • I did fix the divide by 0 issue, When you said Use this function as an alternative to the operator && (AND), are you referring to AND(condition1,condition2,condition3) ? I have used the same in my entry criteria. I did not get you here. – Rao May 23 '17 at 17:11
  • actually, that is salesforce formula definition, in case you defined the criteria as a formula then you can either use AND or &&, like this condition1 && condition2 && condition3 – Santanu Boral May 23 '17 at 17:13
  • your issue will be resolved if you fix divide by 0 issue, that is for sure – Santanu Boral May 23 '17 at 17:14
  • The divide by 0 did fix the issue, but my question is why the condition 2 in my AND() evaluated to true, despite the fact that it clearly was not a pass condition – Rao May 23 '17 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.