createReplicatedDataset

Creates a replicated dataset, also known as a connected object.

Syntax 

1import { createReplicatedDataset } from 'lightning/analyticsWaveApi';
2createReplicatedDataset( replicated Dataset : ReplicatedDatasetInputRepresentation ): Promise<ReplicatedDatasetRepresentation>

CRM Analytics API Resource 

1POST /wave/replicatedDatasets

createReplicatedDataset uses this CRM Analytics API resource.

Parameters 

Parameter NameTypeDescriptionRequired?
replicatedDatasetObjectThe connected object instance to create. Use a Replicated Dataset Input resource.Yes

Returns 

Usage 

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';
4
5export default class CreateReplicatedDataset extends LightningElement {
6  @api connectId; // or fetch the ID of the connector to create the dataset from
7  replicatedDataset = {
8    "connectorId" : $connectId,
9    "connectionMode" : "incremental",
10    "sourceObjectName" : "Asset"
11  };
12
13  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.

1<template>
2  <lightning-button
3    label="Create"
4    icon-name="utility:play"
5    icon-position="right"
6    onclick={create}
7  ></lightning-button>
8</template>

Release Preview

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.