-1

The formulas work separately but I need the formula to evaluate the formulas in a "or" situation. IF I use & for the first formula - it concatenates the field but I want a Closed Or an Open value.

IF(ISPICKVAL( Shipped__c , "C"), "Closed", "Open")    
OR
IF( Outstanding_Quantity__c  <= 0, "Closed", "Open")

Or this 2nd formula would also accomplish my goal -

IF(ISPICKVAL( Shipped__c , "C"),
CASE( zzItemCategory__c ,
"ZBIL", "Closed",
"ZRTN", "Closed",
"Open" )
, "Open")

The issue with the second formula is that it only evaluates the Case section and not the pickval portion of the formula.

1 Answer 1

0

Things like &, &&, ||, AND(), and OR() have specific meanings in formulas. Formulas in Salesforce means you actually are writing some code (albeit a more limited version of "coding" compared to writing "actual code" in a language like Apex).

So while you don't need hours upon hours of learning like you do with "actual code", you do still need to think like a computer.

& or + concatenates strings together
&& and AND() are both the Boolean "And" function (i.e. if everything being AND-ed together is true, then the result is true)
|| and OR() are both the Boolean "Or" function (if any of the things being OR-ed together is true, then the result is true)

For simple IF() statements like this, writing down what you want to do in plain language (English, German, Afrikaans, whatever) first can be helpful because your formula should end up reading similar to plain language.

That is, you are trying to say

if field x has this value, or field y has that value, then output1, else, output2

rather than

if field x has this value, then output1, else output2
if field y has that value, then output1, else output2

Put more plainly, your two fields should be part of the same IF() statement

IF(
    OR(
        /* field X has this value or */
        ISPICKVAL(Shipped__c , "C"),
        /* field Y has that value */
        Outstanding_Quantity__c  <= 0
    ),
    /* then output */
    "Closed",
    /* else output (when Shipped is not C and outstanding qty > 0) */
    "Open"
)

You must log in to answer this question.

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