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
hemmhemm 

Using the value of a picklist field

I have added additional address fields in Salesforce and am using a pick list for the country name to help with data quality.  I am trying to create links to map websites using a HYPERLINK formula field.  I am including the country field in there, but the formula says that I can only include this field within the ISPICKVAL function. 

Am I really unable to use the value selected in the picklist in a formula?  Or do I have to create another formula with a CASE function that goes through every picklist value and provides a text equivalent?

If the latter, can you please add an enhancement request to be able to use the value from a picklist field as if it were text?

Thanks.
ScotScot
Unfortunately, you've got it right ... you need to use a bunch of ISPICKVAL functions to either test the value or convert it into a text value.
 
This has come up a number of times, so I'm sure it's on the request list ... but you should submit a feature request too to up the priority.
hemmhemm
To further add to the impact of this limitation is another limitation as to the number of characters that can be processed by a formula.

We are capturing 4 different addresses.  Each one has a country field with a list of countries (235 in the list).  We have a Mailing Address Indicator field that allows a user to indicate which of these 4 are the primary Mailing Address.  We then have formula fields to derive the Mailing Address for each Client based upon the selection in the Mailing Address Indicator.  This allows you to do a mailing to the primary mailing address whether that address is the Home Address, Business Address, etc. Anyway, I was going through the process of creating formula fields.  Examples below.

Field 1:
Code:
CASE(1,
IF(ISPICKVAL({!OK_Billing_Country__c},"Afghanistan"), 1, 0),"Afghanistan",
IF(ISPICKVAL({!OK_Billing_Country__c},"Albania"), 1, 0),"Albania",
IF(ISPICKVAL({!OK_Billing_Country__c},"Algeria"), 1, 0),"Algeria",
IF(ISPICKVAL({!OK_Billing_Country__c},"American Samoa"), 1, 0),"American Samoa",
IF(ISPICKVAL({!OK_Billing_Country__c},"Andorra"), 1, 0),"Andorra",
IF(ISPICKVAL({!OK_Billing_Country__c},"Angola"), 1, 0),"Angola",
IF(ISPICKVAL({!OK_Billing_Country__c},"Anguilla"), 1, 0),"Anguilla",
IF(ISPICKVAL({!OK_Billing_Country__c},"Antigua And Barbuda"), 1, 0),"Antigua And Barbuda",
IF(ISPICKVAL({!OK_Billing_Country__c},"Argentina"), 1, 0),"Argentina",
IF(ISPICKVAL({!OK_Billing_Country__c},"Armenia"), 1, 0),"Armenia",
IF(ISPICKVAL({!OK_Billing_Country__c},"Aruba"), 1, 0),"Aruba",
IF(ISPICKVAL({!OK_Billing_Country__c},"Australia"), 1, 0),"Australia",
IF(ISPICKVAL({!OK_Billing_Country__c},"Austria"), 1, 0),"Austria",
"")

Field 2:

Code:
IF( {!OK_FORM_Billing_Country_text1__c} = "",
CASE(1,
IF(ISPICKVAL({!OK_Billing_Country__c},"Azerbaijan"), 1, 0),"Azerbaijan",
IF(ISPICKVAL({!OK_Billing_Country__c},"Bahamas"), 1, 0),"Bahamas",
IF(ISPICKVAL({!OK_Billing_Country__c},"Bahrain"), 1, 0),"Bahrain",
IF(ISPICKVAL({!OK_Billing_Country__c},"Bangladesh"), 1, 0),"Bangladesh",
IF(ISPICKVAL({!OK_Billing_Country__c},"Barbados"), 1, 0),"Barbados",
IF(ISPICKVAL({!OK_Billing_Country__c},"Belarus"), 1, 0),"Belarus",
IF(ISPICKVAL({!OK_Billing_Country__c},"Belgium"), 1, 0),"Belgium",
IF(ISPICKVAL({!OK_Billing_Country__c},"Belize"), 1, 0),"Belize",
"")
,{!OK_FORM_Billing_Country_text1__c})

Since the formula fields have a character limit in each one, I had to break it into multiple fields.  Once I got to field 3, I got beyond the number of characters that a formula field can process at once.  Apparently, there is an overall processing limit.  If you reference other formula fields in your formula field, Salesforce looks at the compiled size of all of them and has a limit on that.  To work around limitation #1, I was going to need to create ~15 formula fields for each address.  I got as far as field 3 and hit limitation #2.

Can this post act as my request for enhancement to the Salesforce product?

ScotScot
The post here counts for something, but I the ranking of the requests is, I understand, strongly affected by the formal requests. These can be entered by calling the support people or by entering the request from the "Help and Training" link on a non-developer account.
MigMig
Hi,

sorry to upload this thread, But I've got the same problem. Is there any solution since this thread ?

Thank you for the help ...

Mig