8

Can Custom Metadata be mass inserted?

My Custom Metadata Type is listed as a custom object in the Data Import Wizard but when I -

  1. select the object
  2. add new records
  3. choose the CSV file
  4. next

none of the fields are mapped and when I click Map an error's displayed

Something has gone wrong. Cannot read property 'length' of undefined. Please try again.

The Metadata Type is listed in Workbench for SOQL queries but not when I try to use it's insert function. It's not listed in the list of Dataloader objects.

7

The Data Loader, as far as I can tell, does not support Custom Metadata (and we've been given no indication if this will be available in the future). In fact, custom metadata isn't "real" data, and is actually documented in the Metadata API documentation. You could choose to use Ant and build the appropriate files that way, or you can follow the other instructions for simply loading this metadata.

In the implementation manual, the guide tells you how to import custom metadata:

Edit: The older version, included below in the original quote, has been deprecated. Please use this version instead. It also now includes a Deploy to Salesforce button to make it easier to deploy in fewer steps.


(Page 13)

Use the custom metadata loader to bulk load records to your custom metadata types from a .csv file. The custom metadata loader lets you load up to 200 records with a single call.

  1. Download the tool from GitHub. Deploy the package to your org via Workbench. Note that you have to create a .zip file of the contents of the custom_md_loader directory instead of zipping up the directory itself.
  2. Create a .csv file with a header that contains the custom metadata type’s field API names. Either the Label field or the Developer Name field is required. See sample.csv in your download for an example. If your org is namespaced, be sure to include the namespace prefix in your header.
  3. From Setup, assign the Custom Metadata Loader permission set to the appropriate users, including yourself.
  4. Select Custom Metadata Loader from the App Picker.
  5. Go to the Custom Metadata Loader tab. The app prompts you to configure your Remote Site Settings if you haven’t already done so.
  6. Select your .csv file and the corresponding custom metadata type.
  7. Click Create custom metadata to bulk load the records from the .csv file.
  • 2
    The linked tool is deprecated (04/04/18). There is a supported Salesforce version of the tool on Github – Dizzley Apr 4 '18 at 10:26
  • 1
    @Dizzley The documentation hasn't been updated yet to reflect this change, apparently, but I can update this answer with this link, since the overall instructions appear to be nearly identical at this point. – sfdcfox Apr 4 '18 at 10:47
  • Well done @sfdcfox. I just stumbled on it today. Your answer was very helpful. I got the official tool to work as expected. – Dizzley Apr 4 '18 at 14:29
  • How do you get this to work on an org that is not a developer org? The instructions say to add in the org namespace, and I am trying to follow the directions, but it doesn't have the edit option, and says we need a developer org. SELECT NamespacePrefix FROM Organization yields nothing. – Chance Aug 28 '18 at 16:18
  • @Chance you don't need a namespace. The Deploy to Salesforce button should work for any org that has API capabilities for any user that has Author Apex permission. – sfdcfox Aug 28 '18 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.