Skip to main content

Salesforce Custom Metadata - usage and advantages



Custom metadata types in Salesforce is a great and powerful feature provided to developers of the platform. Till this feature was provided, developers could only create and modify metadata for the types provided by Salesforce. They could add new objects, new apex classes etc. With custom metadata, a developer can define a new metadata type itself. After defining a metadata type, the developer can now add metadata records for this new type.

Whats the biggest advantage? well since this configuration is considered metadata, it is available via the Metadata API. So it can be migrated between environments using migration tools like ANT. Let me explain below with an example -

In our project, we were configuring ability to calculate SLA on a case based on when the case is received into the Queue. That is if the case arrived after a particular time (say 4 PM), it would be considered as arrived next day and SLA should be calculated only from the next day. Now, each queue in the system had a different cutoff time based on that team's requirements. This could be achieved in different ways however what i want to focus on is how we stored this cutoff time information for different queues. This information can be considered configuration data that needs to be present in each sandbox and production environment.

Option 1: Custom Object
We could create a custom object that stored records with the Queue name and its corresponding cutoff time in each record. While configuring this object and using it in say Apex code would have been easy, the issue would normally be with migrating the data between sandboxes and production.
Hypothetically if we had 50 queues, we would have 50 records in this custom object. Now to move this configuration to Production, there would be two steps -

  1. Migrate the custom object, fields etc to Production via changesets or ANT migration tool
  2. Migrate the 50 records using data loader or manually
Using custom metadata, we can avoid this second manual step. Remember this second step needs to be done for each sandbox environment you have between the developer sandbox and production.

Option 2: Custom metadata
Instead we created a custom metadata type called "SLA Cutoff Setting" and used it to capture the cutoff time configuration records using this metadata type. Now to migrate it to another environment, we can simply use ANT or change sets. Since the records are considered metadata, they can be migrated just like any other metadata. Using change sets, both the new metadata type and its 50 metadata records can be transferred to the new environment.

You must see the advantage of this especially if you have multiple such configuration data in different custom objects or custom settings in your Org!

In my next post, i will share details of creating the custom metadata type and then migrating it using the Force Migration tool (ANT based).
Link to the next post - Salesforce Custom Metadata - creation and migration

Comments

  1. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.Block Chain Training in chennai

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up. 
    Oracle training in pune
    Oracle Online Training
    Oracle training in Bangalore
    Oracle training in Sholingaanallur
    Oracle training in marathahalli

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete

Post a Comment

Popular posts from this blog

Workaround to bypass Salesforce SSO

One of the best practices for implementing Single Sign On for your Salesforce org is always ensure there is a way your System administrator can login via the standard login page side-stepping the SSO configuration.  Reason for this is if ever something goes wrong with your Idp provider's service and the SSO authentication responses are not coming as expected, all your users are unable to login. That is, if you have setup your My domain to prevent logins via standard Salesforce login urls (login.salesforce.com). This includes the System administrator as well. Only if your system administrator can somehow login, then he or she can disable the SSO settings for your domain and allow login via the normal login page as a temporary measure. What do you do in such a situation? Well Salesforce has built a workaround for this which is not well documented anywhere (probably for a good reason :) ). I found out about it from a colleague at work. If your my domain url is - https://Com

Salesforce Big Objects - Key learnings

I remember reading about Salesforce Big Objects before they became available and thought maybe it is an option to backup data present in regular objects. That is, instead of taking a backup via an ETL tool or data loader, maybe this will be an option to backup the data in the Force.com platform itself. Now that it is GA and I am reading more about it, i think the use cases for this are more varied. Some use cases I can think of are –  Archival of key data objects within the platform: You may want to use this option if you dont use any other means to backup key data. Also this may be an attractive option for non-large enterprise customers who dont themselves invest on large data warehouses or data lakes in their enterprise architecture. Ex: customer history (if present in tasks and activities) will become huge over years but this is useful information for reporting & customer analysis. Store key information which is large volume in quantity and also high volume in transa

DBAmp for Salesforce - salesforce integration for SQL Server DBAs

Recently i got the opportunity to explore a tool called DBAmp for integration with Salesforce. I found it to be a very useful tool which will help with any data manipulation requirements in Salesforce. Following are my learnings from the exercise. Hope it helps any of you who may need to work with this tool -  DBAmp is a SQL Server package that can be used to integrate with Salesforce. The site where this software is available is - http://www.forceamp.com/ Overview: It essentially installs on top of an existing SQL Server database and provides an OLE DB connector that can be used to connect to Salesforce. Behind the scenes, it executes API calls against Salesforce for any SQL server command it receives. Thus we can create a connection in SQL server to Salesforce org and pull data into tables in the database just as if we are querying against Salesforce tables directly. Use cases for DBAmap + Salesforce: Many use cases exist for using this tool against Salesforce. Pr