I have a scenerio which is based on a field of a record. This field is a lookup relation ship to another record. Example on my abc__c object I have lookup to xyz__c object. The xyz__c object has a field named type__c. My formula is based on xyz__c and type__c values. The condition is:

  1. If xyz__c is not blank
  2. type__C has one of these values -> 'CAR' , 'TRAIN' , 'BIKE' or 'PLANE' If the above 2 condition satisfies then formula field should have 'FALSE' else it should have 'TRUE' text. Formula is a text type field.

This is what I got started with:

    OR ( ISBLANK(xyz__c), 
    UPPER(xyz__r.type__c) != 'CAR' ||
    UPPER(xyz__r.type__c) != 'TRAIN' || 
    UPPER(xyz__r.type__c) != 'BIKE' || 
    UPPER(xyz__r.type__c) != 'PLANE'

What I am know that I should be doing is putting all the combination of type__c in the formula field, meaning there could be case when the field has 'PLANE' instead of 'CAR' so I might have to cover all those cases in the formula field. Is that correct? Is there a better way to implement this formula field?


The formula will be as follows:

    && UPPER(xyz__r.type__c) != 'CAR' 
    && UPPER(xyz__r.type__c) != 'TRAIN'  
    && UPPER(xyz__r.type__c) != 'BIKE' 
    && UPPER(xyz__r.type__c) != 'PLANE', 
  • Thank you. There is just one condition in this that I missed. If xyz__c is blank then it should return 'TRUE'. Meaning there is no need to check the type__c field if xyz__c field values is not present.
    – SfdcBat
    May 17 '17 at 18:28
  • You can add it accordingly May 17 '17 at 18:30
  • Quick question - Do you think I should be using UPPER here? Is it case sensitive here?
    – SfdcBat
    May 17 '17 at 18:46
  • UPPER is good for text comparison, if you are allowing user to enter the values May 17 '17 at 18:48
  • 1
    It is case sensitive, so xyz__r.type__c == "CAR' is not same as xyz__r.type__c == 'Car' May 17 '17 at 18:54

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.