Your Salesforce Org is made up of two types of data:

  • Data - You know about this: it's your Contacts, Accounts, Opportunities, etc.
  • Metadata - This is data about your data e.g. the configuration of your custom objects, custom fields, page layouts etc.

Apex code in Salesforce has always been able to update data - that's one of its core functions. But, it has not been able to access the metadata.

In a great example of Salesforce listening to developer feedback, they are now starting to allow Apex code to read/update metadata. 

The article describes a number of use-cases - the two most interesting for us are:

  • ISVs writing AppExchange packages can already add custom fields to standard objects. Now, they will be able to add those new fields to page layouts automatically
  • Enterprise customers with complicated configurations will be able to have custom setup pages which group together configuration of settings in a way that makes sense for their particular organisation

As Salesforce add more to this new feature, it's going to get more and more useful!