Use createReplicatedDataset to create a connected object. For example, create a connected object for Asset data with the connectorId, connectionMode, and sourceObjectName.
This example adds a create button to a page. The page must contain form elements for the information required to create the connected object, like the sourceObjectName. Creating a connected object displays a toast message using the lightning/platformShowToastEvent module.
1import{LightningElement, api}from 'lwc';2import{createReplicatedDataset}from 'lightning/analyticsWaveApi';3import{ShowToastEvent}from 'lightning/platformShowToastEvent';45export default class CreateReplicatedDataset extends LightningElement{6 @api connectId; // or fetch the ID of the connector to create the dataset from7 replicatedDataset = {8 "connectorId" : $connectId,9 "connectionMode" : "incremental",10 "sourceObjectName" : "Asset"11};1213 create(event){14 createReplicatedDataset({replicatedDataset: this.replicatedDataset}})15 .then(()=>{16 this.dispatchEvent(17 new ShowToastEvent({18 title: 'Success',19 message: 'Connected Object Created',20 variant: 'success'21})22);23})24 .catch(error =>{25 this.dispatchEvent(26 new ShowToastEvent({27 title: 'Error creating connected object',28 message: error.body.message,29 variant: 'error'30})31);32});33}34}
This button calls the createReplicatedDataset() method.
This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.