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
glowitzglowitz 

Method to find Partial String in Picklist Value

I need a way to find a partial string in a picklist value as part of a formula I'm building. For example, the picklist has many options, such as:

USPS Priority Mail
USPS Overnight
USPS Global Priority Mail
FedEx Economy.
.... and about 20 other options that all start with USPS, UPS, FEDEX, DHL, etc.

Rather than testing for every picklist value, I want to perform an action only if certain words are contained within the picklist string, such as "USPS" or "FedEx".

Essentially, I need the functionality of the CONTAINS attribute. But this only seems to work on free text fields, not picklists.

Does anyone have any suggestions on how to achive this? Unfortunately, I can't retroactively change the picklist field, as this would destroy all existing data....so I'm stuck with it the way it is now.... and if I include all the options, the formula becomes too long and exceeds the maximum allowable character length -- plus it's awkward to manage...
The current code is:

CASE(  Shipment_Method__c  ,
"USPS" , HYPERLINK("http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum="& Shipment_Tracking_Number__c,"Track USPS Shipment"),
"FedEx" , HYPERLINK("http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers= "& Shipment_Tracking_Number__c,"Track FedEx Shipment"),
"UPS", HYPERLINK("http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&sort_by=status&loc=en_US&InquiryNumber1= "& Shipment_Tracking_Number__c & "&track.x=32&track.y=7", "Track UPS Shipment") ,
"DHL", HYPERLINK("http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=" & Shipment_Tracking_Number__c,"Track DHL Shipment"), "")
 
In essence, I'd like to put the phrase CONTAINS (Shipment_Method__c,"USPS") as a qualifier, but this doesn't work as CONTAINS appears to work only on text fields, not picklists.
 
Thanks for your suggestions.

JakesterJakester
Hi Glowitz,

Welcome to the worst thing about Salesforce. Despite this idea being voted on over 250 times, Salesforce is showing no signs of fixing this anytime soon.