updateWaveFolder

Updates a specific CRM Analytics folder by ID.

Syntax 

1import { updateWaveFolder } from 'lightning/analyticsWaveApi';
2updateWaveFolder({ folderId: string, folder: BaseWaveFolderInput }): Promise<WaveFolder>

CRM Analytics API Resource 

1PUT /wave/folders/${folderId}

updateWaveFolder uses this CRM Analytics API resource.

Parameters 

Parameter NameTypeDescriptionRequired?
folderIdStringThe ID of the folder.Yes
folderObjectThe folder to update. Use a Base Wave Folder Input resource.Yes

Returns 

  • A Promise object that resolves with the Wave Folder response.

Usage 

Use updateWaveFolder to allow users to change folder name, label, status, sharing, and more. This example adds an update button to a page with folders. The page must contain form elements for the information required to update the folder. Updating a folder displays a toast message using the lightning/platformShowToastEvent module.

1import { LightningElement, api } from "lwc";
2import { updateWaveFolder } from "lightning/analyticsWaveApi";
3import { ShowToastEvent } from "lightning/platformShowToastEvent";
4
5export default class UpdateWaveFolder extends LightningElement {
6  @api fId; // or fetch the ID of the folder
7  folderObj = {
8    label: "Updated folder",
9    isPinned: false,
10  };
11
12  update(event) {
13    updateWaveFolder({ id: this.fId, folder: this.folderObj })
14      .then(() => {
15        this.dispatchEvent(
16          new ShowToastEvent({
17            title: "Success",
18            message: "Folder updated",
19            variant: "success",
20          }),
21        );
22      })
23      .catch((error) => {
24        this.dispatchEvent(
25          new ShowToastEvent({
26            title: "Error updating folder",
27            message: error.body.message,
28            variant: "error",
29          }),
30        );
31      });
32  }
33}

This button calls the updateWaveFolder() method.

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