Skip to content

Releases: jongpie/CustomMetadataSaver

Unlocked package release

09 Aug 22:49
3e86d8c
Compare
Choose a tag to compare

Created a new unlocked package for the repo - the package has been promoted, so it can be installed in production, sandboxes and scratch orgs

New 'custom metadata table' lightning web component

21 Jul 19:24
d164bf2
Compare
Choose a tag to compare

Initial beta release of a new lwc datatable that's designed to handle custom metadata type (CMDT) records

Using custom-metadata-table component

The component can be used within screen Flows or within other lightning web/aura components. It requires 3 parameters:

  1. records - an instance of List<SObject> in Apex, or a 'record collection' within Flow, containing the CMDT records to display within the table. All of the SObject records must be of the same SObject Type. You can create or query the list of CMDT records - see README for details on how to create CMDT records in Apex and All CMDT records must have both fields DeveloperName and MasterLabel populated in order to successfully deploy the new records.
  2. fieldsToDisplay - a comma-separated list of field API names that should be shown in the table. When the paremeter enableEditing == true, all fields, except DeveloperName and lookup fields, will be editable within the table. This is done via the lightning-datatable's inline-editing functionality
  3. enableEditing - Boolean value to control if CMDT records are displayed in read-only mode (enableEditing == false) or with inline-editing enabled (enableEditing == true)

Once the table is configured, it displays the CMDT records in a lighting-datatable component

image

When users edit 1 or more fields, the standard Save and Cancel buttons are automatically displayed on the lightning-datable component:

  • When a user clicks Cancel, any unsaved changes to the CMDT records are discarded, and all field values are reverted to their original value.
  • When a user clicks Save, a loading-spinner is displayed to prevent any additional changes while the CMDT records are deployed asynchronously to the current org. Once the deployment finishes (either by successfully deploying the CMDT records or by failing due to an error), then the component removes the loading-spinner-icon, and users can resume interacting with the component.

Known Issues/Limitations

  • Picklist fields are not currently properly rendered as a picklist - this PR's code renders them as a text field, which works, but this needs to be addressed in a future
  • New button/action to create a new CMDT record from within the table
  • Column sorting functionality is not currently implemented