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
jeff.lopezstuitjeff.lopezstuit 

custom lookup field/CASE formula

Is it possible to use the value in a custom lookup field as the "value" argument in a CASE formula? Here's my situation:

I have a custom formula in my contact object called "NTEE_Name__c", that looks like this:

CASE( {!NTEE_Code__c} , "B12", "Fund Raising & Fund Distribution", NULL)

where NTEE_Code__c is a custom lookup field. That field appears in the list of custom fields that can be used in a formula on my customer object, and the formula validates just fine, so it looks like it should work.

However, when I look at a record that has a value of "B12" in NTEE_Code__c, the value of NTEE_Name__c is null.

Can anyone see a problem with the formula, or is the problem that I'm trying to use a lookup field?
jeff.lopezstuitjeff.lopezstuit
I heard back from SF today that this is in fact NOT possible - you can't use lookup fields in a formula, even though the application includes it in the list of fields that can be used.
have questionshave questions

I had similar issue: we are offering special discount to specific customers, so there is a "discount" field in "opportunity", and I wanted to create a formula for this field, something like: (account name is a lookup field in opportunity)

Case({! account_name__c},

"A", 0.1,

"B", 0.3,

0)

 

Paul.FoxPaul.Fox

That's not completely true.  You can use the {!NTEE_Code__c} field in a formula.  However, it will return the ID of the object, not the name.  So if B12 refers to one record, then you can find the ID of that record and put it in the formula instead of "B12". 

The same thing goes for the account fields.  You can't enter the names of the accounts for the discount percent, but if the accounts have already been created, then you can go find the IDs of all of the accounts and put them into the case function.

To find the ID of the object that you are looking for, just go to the object in Salesforce.  The object's ID can be found at the end of the address. 

Example: https://na3.salesforce.com/a0W300000004Kmy  (a0W300000004Kmy is the ID)

Paul