Pages

Thursday, January 07, 2016

Salesforce Custom Metadata Types

Its been a while since Salesforce introduced the Custom Metadata Type feature..

if you are wondering how you can make use of this, here's a use case which I recently worked with.

Store all your integration settings in one place, Yes in a single Custom Metadata instead of multiple Custom Settings

Create a custom metadata type called Integration Settings. Include Fields to identify which external system it is, which environment, and the other additional connection details like the endpoint url, username, password, timeout etc..

Create a Utility class method in Apex which takes the external system name we want to connect to as a parameter, and then identifies the current salesforce environment (say production or sandbox using the Organization details ) and returns the connection details for that system in that environment.

With this, we don't need to ever worry about missing integration details during deployments or having incorrect urls in different environments due to sandbox refresh or migration custom settings data between environments or manually creating configuration details.




No comments: