function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Saving Application Settings

Hello all,


I'm trying to make an application that allows the user to define certain settings and have them be re-used the next time the application is opened. I see that you can define custom settings:


But the method for doing so described there requires making changes in the Salesforce UI. I don't want my users to have to muck around with doing so; is there a way to have my application create the custom settings programmatically the first time it is run?


Alternatively is it possible to create a custom database object programmatically, and store the information that way?



Ralph CallawayRalph Callaway

If your application uses APEX this shouldn't be too much of an issue, you can:

  1. Default the custom settings (by setting the org wide defaults)
  2. Change the custom settings programmatically with APEX
  3. You can create a custom object and store the settings there

My application does use APEX - really, the question I meant to ask was how I can do this programmatically with APEX. :) I've seen stuff about how to create and update custom settings and objects, but not how to define new ones.

Cory CowgillCory Cowgill

You can use the Metadata API to define custom settings.


Custom Settings are a special type of Custom Object in the system. If you are in Eclipse IDE you can browse your Custom Objects and see your custom settings, and they have special tags which indicate they are custom settings.

Ralph CallawayRalph Callaway

eriktown, the apex docs have a whole bunch of methods for changing the values in custom settings


Custom Settings