A semi-recent feature of salesforce is Custom Metadata Types. The are like custom settings, but better in many ways.

One of these is very important…  they are deployable! Just like any other piece of metadata (fields, objects, classes, etc) Anyone who has ever dealt with custom settings before, knows what a gigantic pain in the ass it is to keep environments in sync.

However, they have some limitations… While they can be accessed from within apex classes, unlike custom settings they cannot be modified programmatically (well, they can but its not that easy).

Also, unlike custom settings, there is no easy way to populate them in bulk (e.g via workbench, dataloader, etc). Salesforce do give you an option, but it kind of sucks (it involves deploying code to your org, etc, etc)

Faced with having to load ~200 custom metadata type records, and not wanting add an app to my org when I didn’t have to. I decided to write a tool instead.

Presenting: Meta Dataloader!

https://meta-dataloader.herokuapp.com/

This is a similar tool to SchemaPuker (infact, i reused a LOT of the code from it) that performs one specific task, it can take a CSV and create custom metadata type records from it.

Once you’ve logged in, you simply choose the Metadata type you wish to load records in to, and if you want to upsert or delete records.

screen-shot-2016-12-02-at-5-41-04-pm

You then need to upload a csv of the values you wish to load, with the headings matching the field API names (similar to workbench)

screen-shot-2016-12-02-at-5-44-27-pm

Click submit, and the records will be upserted or deleted

screen-shot-2016-12-02-at-5-38-28-pm

The tool is pretty basic, but it solves a problem. It took me ~3 hours to put together, so it may have issues.

If you find it useful, let me know, and likewise let me know if you find any bugs.

The code for this is available on my github

4 thoughts on “Why I love/hate custom metadata types: Introducing Meta Dataloader

  1. Hi, While uploading records I am getting error
    Whitelabel Error Page
    This application has no explicit mapping for /error, so you are seeing this as a fallback.

    Fri May 25 09:27:02 UTC 2018
    There was an unexpected error (type=Internal Server Error, status=500).
    7
    I have thousands of records to upload.
    Please help.

  2. Hi Michael,

    I’m getting an error when I log in. I’ve tried using ‘Production’ and ‘Custom URL’ both. It is a dev org, but I don’t see why that would matter. Any thoughts?

    Whitelabel Error Page
    This application has no explicit mapping for /error, so you are seeing this as a fallback.

    Tue May 29 13:12:45 UTC 2018
    There was an unexpected error (type=Internal Server Error, status=500).
    Response body is incorrect. Can’t extract a ‘”access_token”\s*:\s*”(\S*?)”‘ from this: ‘{“error”:”unsupported_grant_type”,”error_description”:”grant type not supported”}’

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.