updateDatasetVersion

Updates a specific CRM Analytics dataset version by dataset ID and version ID.

Syntax 

1import { updateDatasetVersion } from 'lightning/analyticsWaveApi';
2updateDatasetVersion({ datasetIdOrApiName: string, versionId: string, datasetVersion: DatasetVersionInput }): Promise<DatasetVersion>

CRM Analytics API Resource 

1PUT /wave/datasets/${datasetIdOrApiName}/versions/${versionId}

updateDatasetVersion uses this CRM Analytics API resource.

Parameters 

Parameter NameTypeDescriptionRequired?
datasetIdOrApiNameStringThe ID or API name of the dataset.Yes
versionIdStringThe ID of the dataset version.Yes
datasetVersionObjectThe dataset version to update. Use a Dataset Version Input resource.Yes

Returns 

Usage 

Use updateDatasetVersion to allow users to update the predicate. This example adds an update button to a page with dataset versions. The page must contain form elements for the information required to update the dataset version. Updating a dataset version displays a toast message using the lightning/platformShowToastEvent module.

1import { LightningElement, api } from "lwc";
2import { updateDatasetVersion } from "lightning/analyticsWaveApi";
3import { ShowToastEvent } from "lightning/platformShowToastEvent";
4
5export default class UpdateDatasetVersion extends LightningElement {
6  @api dId; // or fetch the ID of the dataset
7  @api vId; // or fetch the ID of the dataset version
8  datasetVersion = {
9    predicate: "<predicate value>",
10  };
11
12  update(event) {
13    updateDatasetVersion({
14      datasetIdOrApiName: this.dId,
15      versionId: this.vId,
16      datasetVersion: this.datasetVersion,
17    })
18      .then(() => {
19        this.dispatchEvent(
20          new ShowToastEvent({
21            title: "Success",
22            message: "Dataset version updated",
23            variant: "success",
24          }),
25        );
26      })
27      .catch((error) => {
28        this.dispatchEvent(
29          new ShowToastEvent({
30            title: "Error updating dataset version",
31            message: error.body.message,
32            variant: "error",
33          }),
34        );
35      });
36  }
37}

This button calls the updateDatasetVersion() method.

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