2

I thought that should be able to wrap a bunch OR conditions with an AND that would require TRUE from each OR such as this.

AND(OR(ISPICKVAL(Apttus_Proposal__Opportunity__r.Sales_Typ__c, "New"),
ISPICKVAL(Apttus_Proposal__Opportunity__r.Sales_Typ__c, "Migration")), 
Apts_Rollup_Net_Price_11__c >= 4000, Total_Adjustment_Percentage__c > 0)

or this

AND(OR(ISPICKVAL(Apttus_Proposal__Opportunity__r.Sales_Typ__c, "New"),
ISPICKVAL(Apttus_Proposal__Opportunity__r.Sales_Typ__c, "Migration")),
OR(Apts_Rollup_Net_Price_11__c >= 4000), OR(Total_Adjustment_Percentage__c > 0))

but neither seem to work.

thanks for any suggestions.

2
  • Can you explain what the goal is, in words? Otherwise it'll be hard to check the logic and structure of your expressions.
    – Mike Chale
    Commented Aug 10, 2012 at 17:27
  • So you want to trigger when (Sales Type is New or Migration) AND (Net price is more than 4000) AND (the percentage is more than 0)?
    – Mike Chale
    Commented Aug 10, 2012 at 17:57

4 Answers 4

7

For problems like these, I like to back up and do the following:

  1. Check each condition individually to isolate the problem
    1. Check the ISPICKVAL literals for typos
    2. Double-check the comparisons to make sure I didn't reverse the greater-than/less-than signs
  2. Re-format the expression, providing indentation to help see the blocks grouped together
  3. Write the requirement in words, then pseudo-code, then work through the expression with pen and paper to verify I haven't made a logic error
2
  • Yes, I like your thinking, I did prior to posting here the sudo code and even ran each one individually first to verify the individual criteria components worked. Very frustrating, I'm so used to the IF Else conditionals for PHP.
    – Miklr
    Commented Aug 10, 2012 at 17:54
  • 1
    Additionally, you might find using the || and && operators make for easier to read expressions. I wrote a quick post on this here: laceysnr.com/2012/05/…
    – Matt Lacey
    Commented Aug 11, 2012 at 12:13
0

The logic is slightly flawed, I've layed out your first one, with indentation, which makes it clearer what is happening.

AND(
    OR(
        ISPICKVAL(Apttus_Proposal_Opportunity_r.Sales_Typ__c, "New"),
        ISPICKVAL(Apttus_Proposal_Opportunity_r.Sales_Typ__c, "Migration")
    ), 
    Apts_Rollup_Net_Price_11__c >= 4000,
    Total_Adjustment_Percentage__c > 0
)

I'd recommend laying out your code similarly so you can see clearly what is happening.

In this instance it will only return true if the OR, and the check on Apts_Rollup_Net_Price_11__c and Total_Adjustment_Percentage__c all return true. If you can clarify what exactly you want to test for we can probably give you the code you need, but with a neater layout it'll likely help you get there yourself.

0

Try using && and || in place of AND and OR. It makes it much more readable and you may pinpoint your mistake. I've done that with your first formula. The second one doesn't make sense as your ORs wrap only one condition.

(ISPICKVAL(Apttus_Proposal_Opportunity_r.Sales_Typ__c, "New") || ISPICKVAL(Apttus_Proposal_Opportunity_r.Sales_Typ__c, "Migration")) && Apts_Rollup_Net_Price_11__c >= 4000 && Total_Adjustment_Percentage__c > 0

In pseudo code, you'd read it as Mike stated in his comment: (Sales Type is New or Migration) AND (Net price is more than or equal to 4000) AND (the percentage is more than 0)

2
  • 1
    Thanks Daniel I will try that as well... I did find that what was required was a different custom field lookup value and determiningn null value on the Total_Adjustment_Percentage__c. The logic was correct, just not correct field and no value is present so can't use zero has to be null. This is working now... AND(OR(ISPICKVAL(Apttus_Proposal__Opportunity__r.Sales_Typ__c, "New"), ISPICKVAL(Apttus_Proposal__Opportunity__r.Sales_Typ__c, "Migration")), OR(Total_Initial_Fees__c >= 4000), OR(ISNULL( Total_Adjustment_Percentage__c)))
    – Miklr
    Commented Aug 10, 2012 at 18:29
  • @Miklr Please write your solution up as a separate answer.
    – Mike Chale
    Commented Aug 11, 2012 at 18:28
0

The following finally worked for me:

AND(OR(INCLUDES(Apttus_Proposal__Opportunity__r.Product__c, "HEHR"), INCLUDES(Apttus_Proposal__Opportunity__r.Product__c, "HPM")), OR(ISPICKVAL(Apttus_Proposal__Opportunity__r.Sales_Typ__c, "New"), ISPICKVAL(Apttus_Proposal__Opportunity__r.Sales_Typ__c, "Migration")), Total_Initial_Fees__c >= 4000, Total_Adjustment_Percentage__c > 0)

And in pseudo code it would be: Product is 'HEHR' OR 'HPM', AND Sales type is 'New' OR 'Migration', AND total fees are greater than 4000, AND Total Adjustment Percentage is greater than 0

I then verified it worked against each condition, by testing on a mock proposal and submitting for approval thanks for everyones feedback.

You must log in to answer this question.

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