+ Start a Discussion
dotnet developedotnet develope 

how to compare all values in a picklist with text field using trigger

Hi All,
 
I have existing picklist which contains 100 values and i have text field in an a standard object.
 
i want to compare all values (not the vaue which is selected in a picklist) in  a picklist with text field using trigger.
 
 
please help me in this issue......
 
 
thanks in advance.
Mahesh Chilaka:smileyhappy:
 
Ron WildRon Wild
Hi Mahesh,

What you need is the Describe feature (to retrieve all the possible values in your picklist).  However, Describe is not available in Apex today, this is a future feature.

You will need to keep a copy of the picklist values somewhere else (in your code, in a field in salesforce,...) and search for matches against that string.  If you use a custom field (say, on a custom settings object) you can write an s-control that will update the field so that it contains all of your picklist options, since the 'describe' function is available in AJAX.

I would just save the picklist values in a ';' delimited string since that is Salesforce's convention for storing multi-select list values.  Then Apex has a split() function that you can use to convert the string to a collection before iterating through the values and searching for matches.

It's a hack, but maybe it will work for you until they add 'Describe' to Apex.