In the current system we have key value pairs which are stored in what are called as code tables.

There are quite a lot of code tables. Each has 2 fields one for abbreviation and one for value. For example CA for abbreviation and California for value. What is the efficient way to store key value pairs from these tables in Salesforce? It may not be feasible to create one object per code table just to store values for 2 fields.

  • 1
    What are you trying to do with these key-value pairs?
    – sfdcfox
    Commented Mar 23, 2022 at 21:49
  • We need to store the values from the code tables in the old system in salesforce. Old system is not replaced yet. Mulesoft will be pushing the data to salesforce but if there are any updates in the old system, mulesoft will be pushing the updates and we need to reflect the same in salesforce.
    – sfdev
    Commented Mar 23, 2022 at 21:54
  • 1
    In Salesforce, picklists have a key-value pair system (API Name and Label). You can use it for its intended purpose if you desire.
    – sfdcfox
    Commented Mar 23, 2022 at 22:04
  • If there are any updates in the existing system, I was told mulesoft will not be able to update the pick list values directly. How can we use picklists and still be able to make updates using data from mulesoft ?
    – sfdev
    Commented Mar 23, 2022 at 22:38
  • note that a custom object for a particular code table can be used in VLOOKUP formulas in Validation Rules
    – cropredy
    Commented Mar 24, 2022 at 0:57

1 Answer 1


You could create a custom object called e.g. "Code" with these fields:

  • Code Table Name (could shorten this to just Type)
  • Abbreviation
  • Value

where all rows from the old system from one code table have the same "Code Table Name" value. Then all the old system data can be kept in one custom object.

A custom metadata type - a special form of custom object - could also be used.

Or even just Apex code could be used if the number of values is relatively small and the values will never change. So overall, think about the number of records, whether they change, and who might need to change them which affects how you store them.

  • Thank you Keith. I will research on this options.
    – sfdev
    Commented Mar 24, 2022 at 0:26

You must log in to answer this question.

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