+ Start a Discussion
Gareth DaviesGareth Davies 

AppExchange Platform Feature Suggestion: Name-Value storage.

I'd appreciate your comments on the following suggestion, is it a good idea to have in the platoform or not?
A number of our applications require to store some form of persistent settings/configuration data. We have either done this within custom objects, flat-files or system registry keys. What I propose is to have a new standard object in every Salesforce.com installation that we will know is there and can be used by developers for this purpose:
My Suggestion would be to have an object called "NamedValue" which has the following attributes associated with it (in addition to the standard system info like ID, modestamp etc).
1. Name
2. Namepsace 
3. StringValue (string)
4. NumberValue (number)
5. DateValue (DateTime)
With such an object we could ship S-Controls, Win32 Apps, etc. all of which would know that they could store and retreive values from this storage area without having to package a seperate area for each new control written. (save namespace clashes in AppExchange downloads).
Any thoughts?
Mike LeachMike Leach
Hi Gareth,

I've abstracted picklists using the .NET System.Collections.NameValueCollection class to achieve similar results.


public class PicklistUtil
public PicklistUtil()


public static void UpdateClassPicklistValues(string className)
sForceDB sForce = new sForceDB();
ConfigurationDB configDB = new ConfigurationDB();

DescribeSObjectResult sr = sForce.DescribeSObject(className);
if(sr == null || sr.fields == null || sr.fields.Length == 0)

foreach(Field field in sr.fields)
if(field.type != fieldType.picklist)

string configEntry = string.Empty;
foreach(PicklistEntry entry in field.picklistValues)
configEntry += entry.label + "=" + entry.value + ";";

if(configEntry == string.Empty)

configEntry = configEntry.TrimEnd(";".ToCharArray());
configDB.Update("Salesforce." + className + "." + field.name + ".Picklist", configEntry);
catch(Exception ex)
Log.Insert(PortalCache.PortalContextID, PortalCache.PortalContextID, PortalCache.Instance.EventDefDictionary["SForceService_Exception"], "PreProcessorPicklistValues error processing class '" + className + "'." + ex.ToString());

public static NameValueCollection GetPicklistEntries(string className, string fieldName)
NameValueCollection listVals = new NameValueCollection();
string configKey = "Salesforce." + className + "." + fieldName + ".Picklist";
string configValue = new ConfigurationDB().GetValue(configKey);
if(configValue == string.Empty)
return listVals;

string [] pairs = configValue.Split(";".ToCharArray());
foreach(string pair in pairs)
string [] nameValue = pair.Split("=".ToCharArray());
if(nameValue == null || nameValue.Length != 2)

listVals.Add(nameValue[0], nameValue[1]);
return listVals;