lwc-utils icon indicating copy to clipboard operation
lwc-utils copied to clipboard

Collection Datatable - Display Custom Metadata Type Records

Open solo-1234 opened this issue 3 years ago • 6 comments

I'd like to use CollectionDatatable to display custom metadata records. I use CMDT to store field mappings for some apex code that syncs fields between two objects, and it would be nice to build my own custom UI for managing those.

I would pair it with https://github.com/jongpie/CustomMetadataSaver to actually save new/edited records to the server (since you can't DML them within flow).

Thanks!

solo-1234 avatar Mar 09 '21 19:03 solo-1234

cc @jongpie

jamessimone avatar Mar 10 '21 04:03 jamessimone

ETA end of mid to end of april, I think

tsalb avatar Mar 11 '21 23:03 tsalb

New ETA, end of May => June?

tsalb avatar May 04 '21 20:05 tsalb

De-prioritizing this as my foreseeable future is pretty slammed. Deferring back to backlog and hopefully someone else can pick up!

tsalb avatar Jul 08 '21 22:07 tsalb

Per Discord, there is a limitation of LDS (dependency for figuring out columns) on not being able to work against cmdt.

Seems like this is a no go for now, since column attribute reconstruction via apex is off the table (design ethos: keep it lightweight).

tsalb avatar Jul 09 '21 01:07 tsalb

For what its worth: a rough test allowed me to retrieve Object Info for a CMDT using uiObjectInfoApi. Seems like the salesforce dependency has been since resolved, unless there was a further "gotcha" that I'm missing

The CMDT here is just a sample that happened to be in the org i was testing this in, but seems to work on any CMDT

getCmdInfo.js

import { LightningElement, wire } from 'lwc';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';

export default class GetCmdtInfo extends LightningElement {
    error;
    objectInfo;

    @wire(getObjectInfo, { objectApiName : 'RKQ__Questionnaire_Action__mdt'})
    wiredObjectInfo({ error, data }) {
        if (error) {
            this.error = error;
        } else if (data) {
            this.objectInfo = JSON.stringify(data,null,2);
        }
    }
}

getCmdInfo.html

<template>
    <lightning-card title="Object Info">
        <pre>{objectInfo}</pre>
    </lightning-card>
    <lightning-card title="Error">
        {error}
    </lightning-card>
</template>

Result: image

jakranz33 avatar Oct 14 '21 21:10 jakranz33