Are you really going to make we write this?

Last Updated on Wednesday, 21 January 2009 11:20 Written by Steve Wednesday, 21 January 2009 11:20

Salesforce.com, why do you make me write this just to get the text value from a picklist?

CASE(
     Parsed_Home_Street_Type__c,
     "Aly","Aly",
     "Ave","Ave",
     "Baum","Baum",
     "Blvd","Blvd",
     "Cir","Cir",
     "Close","Close",
     "Court","Court",
     "Cres","Cres",
     "Dvrsn","Dvrsn",
     "Dr","Dr",
     "Grn","Grn",
     "Hill","Hill",
     "Hwy","Hwy",
     "Mews","Mews",
     "Ln","Ln",
     "Pkwy","Pkwy",
     "Pssge","Pssge",
     "Pl","Pl",
     "Quay","Quay",
     "Rd","Rd",
     "Row","Row",
     "Sq","Sq",
     "St","St",
     "Wlk","Wlk",
     "Way","Way",''
)

I think platform creators, like Salesforce.com, should judge themselves on if they allow their customers to write good code. This is not good code. See if you can spot the inefficiency.

And there is nothing I can do about it. It’s the only way to get the text value of a picklist. Salesforce.com owns the platform–I have to wait for them to change it.

The first inkling this will get fixed came in the Spring ’09 release which has a fix when using picklists in Validation Rules. But I want to use picklists in formula fields, so until at least the next release, as Louis C.K. would say, “I’m writing CASE statements with hard-coded values like an a**hole!”

Learn More
Copyright © 2009 Afterburner - Free GPL Template. All Rights Reserved.
WordPress is Free Software released under the GNU/GPL License.