Skip to content

Salesforce Custom Metadata Type Loader, designed for Lightning Experience

License

Notifications You must be signed in to change notification settings

maaaaarco/spaghetti-cmd-loader

Repository files navigation

release

Custom Metadata Loader

Create or Update Custom Metadata Type records from CSV file. Read more about this project.

Installation options

Deploy to Salesforce

URL (recommended)

This approach is recommended since all components will be deployed using a namespace, removing the chance of failures due to conflicting API names.

Unlocked package (recommended)

You can install this as an Unlocked Package, using the CLI, by running the following command:

sfdx force:package:install --package "04t1t000003LfYEAA0" --targetusername YOUR_ORG_ALIAS --wait 10 --publishwait 10

This approach is recommended since all components will be deployed using a namespace, removing the chance of failures due to conflicting API names.

Manual

You can install this by cloning the repository and deploying the content of cmd-loader folder. Before that you should remove the namespace property in the sfdx-project.json file.

"namespace": "spaghettiCMD"

User Guide

After deploying the application follow these step to enable it for your users:

  1. Assign yourself, or ask your System Administrator to assign, the Custom Metadata Loader permission set to your user
  2. In the App Launcher search for Custom Metadata Loader tab
  3. Select the CSV file
  4. Select the Custom Metadata Type
  5. Click on Load Records button

Field types supported

  • Checkbox
  • Date, the specified string should use the standard date format “yyyy-MM-dd”.
  • Datetime, the specified string should use the standard date format “yyyy-MM-dd HH:mm:ss” in the local time zone.
  • Email
  • Number
  • Percent
  • Phone
  • Picklist
  • Text
  • Text Area, supports multiline text
  • Text Area Long, supports multiline text
  • URL

CSV columns

CSV columns must match the API name on your Custom Metadata Type fields. The CSV file must include these columns:

  • DeveloperName, is the unique identifier for the record
  • One between MasterLabel or Label, for the record's label

Limitations

This application does not impose any hard limit on the CSV file size or number of rows but it is subjected to all Apex Governor Limit.

If your CSV file contains more than 250 rows the application will automatically split it into smaller chunks of 250 rows each. Chunks will be loaded sequentially.

For more complex use cases consider that the Salesforce CLI has a bunch of commands to work with Custom Metadata Types. Check them out here.

Demo

YouTube video:

Demo Video

Contribute

If you are interested in contributing, please take a look at the CONTRIBUTING guide.

Credits

  • Papa Parse for its amazing Javascript CSV parser