O Custom Settings, Custom Settings…wherethou art thou Custom Settings?


In the spirit of the upcoming Valentine’s Day, I figure I’ll express my love for something in Salesforce.  (yeah, I know…)

Aaahhh Custom Settings, how do I love thee…let me count the ways:

  1. You allow me to insert admin-customizable variables in Apex code

    Often, you have the need to make profile-specific, record-specific, or on/off flags in your code. In “old school” desktop programming, you could access the registry or manage an ini file for these kinds of things, but in the cloud world there is not really an obvious option anymore.

    You are faced with either being eternally support-bound to the project, or training someone at the client to edit code.  Using Custom Settings, you get it back!  Declarative control over programmatic variables for the win!

  1. You allow me to create a hierarchy of settings per profile

    Need different versions of the same settings for different people, processes, or users? Do you need the decision on what setting is used to be at runtime? Boom.Custom

    Settings can either be in a:

    • List Format – where you can create multiple instances of your settings and refer to them manually throughout your code
    • Heirarchy Format – where you can create profile-specific instances of your settings
  2. You are accessible via the Schema!

    Custom Settings are rendered up just as if they were custom objects. You can create, edit, and delete them through code just as easily as you would through the UI.

On to the screenshots!  In this example, I was creating admin-customizable settings for how to manage confirming room reservations.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s