1

I have a Lookup relationship on Opportunity to an object named PAF. PAF has a formula field named "Result" with the this code: IF(T_Amount__c < 385,"FAIL","PASS").

I want to show this result on the Opportunity page so I created another formula field on Opportunity named "Result" with the this code: PAF__r.Result__c.

The problem is, if the Lookup is populated, then the Opportunity Result field shows correct data. If the Lookup field is empty then it shows "FAIL".

According to my understanding, it should display nothing?

NOTE: I am able to get the expected results, using IF. I just don't understand this behavior.

  • 1
    Basic reason why that happens stays behind internal SF implementation of comparison in formulas. It seems that if PAF__r is null, then PAF__r.Result__c is interpreted as null (or 0 if you change radiobutton is some cases). as well as comparing with null is always false (by salesforce implementation) is less than anything ( (null < 123) == true ), then you get FAIL as result of your formula – kurunve Dec 7 '16 at 13:14
0

Here AnnualRevenue is a currency field. Default value is 0 for currency field. Default value is different for each data type.

if(AnnualRevenue=0,'', 
If(AnnualRevenue < 100,'Fail','Pass'))
| improve this answer | |
  • Can you explain your answer a bit more please. Also I have edited the question please see the new NOTE. – abdn Nov 18 '16 at 12:18
  • it is similar to java if else..'if' condition executes if criteria satisfy. otherwise else block – Shravan Boddula Nov 18 '16 at 12:37
0

Check the value of lookup field fist with ISBLANK(). In the Opportunity Result field use this formula.

IF( ISBLANK(PAF__c ), '', PAF__r.Result__c)

Instead of Only

PAF__r.Result__c
| improve this answer | |
  • Thanks. I have done this to get the correct results. I am not able to understand why PAF__r.Result__c won't show correct data. – abdn Nov 18 '16 at 12:17
0

You can use nested if in your formula to get the expected result. So if lookup field value is null then it won't show anything in the formula

IF(PAF__c <> NULL, IF(T_Amount__c < 385,"FAIL","PASS"), NULL)
| improve this answer | |
  • See the updated question please. – abdn Nov 18 '16 at 12:17

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.