0

In Contact object, I want to add a picklist field "Status". The values in field should have a corresponding numerical values which will be used for computation. The structure is almost similar to the Opportunity Stage field which has the mapping between Stage Name and probability.

I have created a picklist field "Status" in Contact and a custom setting which has two fields to save the value and the corresponding numerical value. In this current system, when a new picklist value has to be added, a new record has to be created in the custom setting. Is there any better way to handle this?

2
  • why not using dependent picklist ?Why custom settings ? Commented Jul 30, 2013 at 13:21
  • Custom setting is used to save the weighted score. For eg. for statuses "Positive" and "Negative", the respective score will be 5 and 0. If a picklist value is added or updated, the admin can add or change the corresponding score in the custom setting.
    – ntnng
    Commented Jul 30, 2013 at 13:47

1 Answer 1

1

Binding picklist values to other behavior has a bunch of less-than-optimal-for-maintenance solutions:

  1. Custom settings as you mentioned
  2. Apex static constants plus triggers and/or VF controllers
  3. Custom objects (akin to custom settings solution)
  4. Encoding the value in the picklist item itself as in "Positive [5]", "Negative [0]" and using string functions/formulas to grab the scores
  5. Using workflow field update formulas to update the Contact.score based on values in the picklist

Item #4 works OK except when the score changes for a given value - in this case, you have to decide what to do about legacy data.

If you use Item#1,2,3 you can use validations to inform the user/sysad that some aspect of the maintenance was omitted

1
  • Thanks. The custom settings seems to be the better solution.
    – ntnng
    Commented Jul 31, 2013 at 10:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .