I'm currently trying to create a tool that creates a metadata record in LWC. I'm using Metadata.Operators.enqueueDeployment(mdContainer, new DeployCallback()) to create a new record, and it's able to create properly. What I'm stuck on is how I can update this record in my LWC when the queue to create/update the record is done.

The hacky method that I currently have is to have a timeout on the frontend to retrieve the data after a certain amount of time (after saving), but I'm assuming there should be a better way to do this that doesn't rely on something like this.


1 Answer 1


Create a Message Channel, then in LWC, use the lightning-message-service to listen for that channel event, and finally, in your DeployCallback, you can use EventBus.publish to notify the LWC that the operation is complete. You can use the ID you get from Metadata.operations.enqueueDeployment to make sure the LWC gets the record it expects. I'd recommend not subscribing until just before you make the initial call, and unsubscribe immediately afterwards, to avoid hitting the Platform Event Limits.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .