Find your content:

Search form

You are here

Dynamic values in standard picklist


Is it possible to create dynamic values for a picklist from a standard picklist option and not in a VF page ?

eg: I want to create a field Close Date as a picklist with Q1/Y1, Q2/Y1, Q3/Y1, Q4/Y1, Q1/Y2, Q2/Y2, Q3/Y2, Q4/Y2 where Y1 – is the current year (i.e. ‘12’ for 2012) and Y2 is the next year (i.e. ‘13’).

Attribution to: Rao

Possible Suggestion/Solution #1

I imagine you could schedule an automation job that would periodically update the values. You can update these values via the Metadata API and that is something that can be run from a command line. In addition to updating the picklist values you will also need to update which values each Record Type uses.

Keep in mind that if you ever need to modify those records in the future that your picklist option may no longer be there.

Edit: Answer updated to change Apex to Metadata API.

Attribution to: Mike Chale

Possible Suggestion/Solution #2

Sounds like insane database design ;)

They're not really related, so why don't you simply create "Year" and "Quarter" picklists? You can always concatenate it later in formula field or something if you wish:

TEXT(Year__c) & ' ' & TEXT(Quarter__c)

Or make a normal date field with help text "Dear user, actual day doesn't matter, just pick anything in proper quarter" and again - format it nicely in formula. Something like this (untested!):

'Q' & IF(MONTH(Date__c) <= 3, '1',
    IF(MONTH(Date__c) <= 6, '2',
        IF(MONTH(Date__c) <= 9, '3',
) & ' ' & TEXT(YEAR(Date__c))

Attribution to: eyescream

Possible Suggestion/Solution #3

You could create a Workflow Field update that fires upon close. The field update could update a text field with something like the following:

IF(Month(Today()) <= 3, "Q1 "+TEXT(Year(Today())),IF(AND(Month(Today()) >3, Month(Today()) <=6), "Q2 "+TEXT(Year(Today())),IF(AND(Month(Today()) >6, Month(Today()) <=9), "Q3 "+TEXT(Year(Today())),"Q4 "+TEXT(Year(Today())))))

This example would update the field with "Q{Current Quarter 1,2,3,4} {Current Year}"

Attribution to: Justin J Carlson
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content