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
aaustinaaustin 

CASE formula syntax check gives "Field does not exist" error message

New salesforce.com user here, so forgive me as I am probably overlooking something simple here. I am trying to use a picklist value to determine the date in another field.  The syntax I am trying to use is

CASE(License_Duration__c, "Temporary: 30-day", TODAY() + 30, TODAY() + 36500).

License_Duration__c definitely exists (it is a custom picklist object), and when I syntax check, I get the error message: "Error: Field License_Duration__c does not exist. Check spelling."

Do I have to set permissions somewhere for this field to be avialable in formulas, or something like that? 



aaustinaaustin
By the way, I am attempting to use this formula as the default value for another field.
werewolfwerewolf
Did you insert the field using the Insert Field button?  Are you sure there's not just some typo in the name?  Remember that the field's label doesn't have to match its API name -- the label may say License Duration, but that doesn't mean the API name isn't Tony_Soprano__c.
aaustinaaustin
That field is not available in the "Insert Field" dropdown.  I am creating this formula in the "Default Values" section of the field, and the only fields available under the "Insert Field" dropdown are the $Organization, $System, etc. fields.  Is there something I have to do to enable my custom fields to be available in the Default Value formula section?
werewolfwerewolf
There's nothing you need to do.  Are you sure this field is a custom picklist on this object?
aaustinaaustin
Yes, both the picklist and the field I am trying to create the formula for belong to the same custom object.
werewolfwerewolf
And when you look at the field definition of that field, its API name is in fact License_Duration__c?
aaustinaaustin
Yes it is.
MarkSilberMarkSilber
Since you are trying to do this as part of the create process using the field defaults, you can't reference any other fields until the record is actually created. You should be able to accomplish what you are doing via a workflow update or a before insert Apex trigger. The field defaults are calculated when you first open the new record screen -- not actually at save time. Since they are calculated when the screen is opened, you really can't reference another field since the other field doesn't have any values at this point.

As you pointed out, the only fields you have access to for defaults are those related to the user performing the action and their related role / profile data.
aaustinaaustin
Thanks for the explanation Mark.  I will look into one of the other methods you mentioned.