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!
We built the Apex Metadata API because we agree “this will be revolutionary for app developers.” Building custom setup wizards, self-configuring apps, and post-install scripts that can update metadata provides ISVs and enterprise developers tremendous new power to simplify app configuration. You and your admins can save time and money, reduce errors, and create new business opportunities.