1

Can Max formula handle fields with blank values?

I have three number fields field a, field b, field c with default value as blank(default custom field setting)

Max(field a, field b, field c) is causing an internal salesforce error if I fill out field a and field c and try to save the record without field b. Strangely I can save the record by just filling out one of the three fields.

Is this because of blank field b and max cannot handle max(blank,value,value), if so has this been documented somewhere?

enter image description here

Update: sorry that I did not clarify, I am using the fields as part of a formula in a workflow rule, so treating it a blank/ zero is not an option

4
  • 1
    Did you raise a ticket with support yet? Did you check the option to treat null values as zero? – Adrian Larson Jun 21 '16 at 23:20
  • Did you use "treat blanks as blanks"? I'd expect it to error; try using "treat blanks as zeroes" instead. – sfdcfox Jun 21 '16 at 23:33
  • I am using the max value in a field update – Rao Jun 21 '16 at 23:58
  • 1
    @AdrianLarson Yep raised the ticket – Rao Jun 22 '16 at 4:18
2

Use BLANKVALUE function for each field: MAX( BLANKVALUE(Field1__c, 0), BLANKVALUE(Field2__c, 0), BLANKVALUE(Field3__c, 0) )

3
  • Thats exactly what i am doing now but my question is along the lines of if salesforce handles it internally , if not is there a doc that connwcts the blankvalue and max function – Rao Jun 21 '16 at 23:59
  • I doubt the error is related to the MAX function itself - does it work well when you have values on all 3 fields used in the calculation? – o-lexi Jun 22 '16 at 0:04
  • yes the goes away and the record saves fine if I go ahead and fill out all three fields the error goes away. I do have recalculate workflow on other workflows as soon as this field update is complete. I do not think the workflow updates are messing up anything – Rao Jun 22 '16 at 4:17
0

Using blank values or if null is only useful if using positive numbers, If I assume null to be 0 and all my other values are negative I'll end up with 0 when it should have been the largest negative value. This is clearly a bug that needs to be fixed on the salesforce side. @Rao what happened with your ticket?

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.