function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sophia Abraham 6Sophia Abraham 6 

Custom formula with Lookup relation custom object

Hi All,
I'm trying to create a new formula field in my custom object.

This formula field is a boolean and it returns true or false based on the conditon

CONTAINS(<obj1_fieldName__c>, <obj2__r.obj2_fieldName__c>).

 

The problem is this returns true for ALL Cases. Even when a value is not present in obj2_fieldName__c for the corresponding obj1_fieldName__c
What am i doing wrong? How must the formula be implememted? "=" returns everything as false.
 

Thanks in Advance.

RD@SFRD@SF
Hi Sophia,

This is a known issue with the contains function. Please, check if the fields names are not blank before using the contains function. If any one of them is blank return false or return the CONTAINS(<obj1_fieldName__c>, <obj2__r.obj2_fieldName__c>) value.

Hope it helps
RD

 
Sophia Abraham 6Sophia Abraham 6

Hi RD, 
Thanks for your reply, None of the fields i'm using have blank values.

Its just that if obj1_fieldName__c = "HI" and corresponding value if "HI" isnt present in obj2__r.obj2_fieldName__c, but it still returns as true, from the formula (CONTAINS(<obj1_fieldName__c>, <obj2__r.obj2_fieldName__c>). 
Any idea why?

RD@SFRD@SF
Hi Sophia,

Please could you share the following details
1) The value is the fields
2) The data type of the fields

Would be help full to look into it
Sophia Abraham 6Sophia Abraham 6

Hi RD,

Sure, Basically I'm trying to compare 2 fields from the 2 tables and get the resultant rows where both the fields match.
obj1_fieldName1__c and obj2_fieldName1__c = Product Names - they are Strings... like a product name (eg: Samsung smart phone)
obj1_fieldName2__c and obj2_fieldName2__c = Version - is a year or a string (eg: 2016 or NIL)

 

Thanks for your time,
Sophia