postWaveFolders

Creates a CRM Analytics folder.

Syntax 

1import { postWaveFolders } from 'lightning/analyticsWaveApi';
2postWaveFolders( waveFolder : BaseWaveFolderInput ): Promise<WaveFolder>

CRM Analytics API Resource 

1POST /wave/folders

postWaveFolders uses this CRM Analytics API resource.

Parameters 

Parameter NameTypeDescriptionRequired?
waveFolderObjectThe folder to create. Use a Base Wave Folder Input resource.Yes

Returns 

A Promise object that resolves with the Wave Folder response.

Usage 

Use postWaveFolders to create a CRM Analytics folder. For example, create a blank folder to contain analytics assets, like dashboards and components.

This example adds a create button to a page. The page must contain form elements for the information required to create the folder, like the name, label, and asset icon. Creating a folder displays a toast message using the lightning/platformShowToastEvent module.

1import { LightningElement, api } from "lwc";
2import { postWaveFolders } from "lightning/analyticsWaveApi";
3import { ShowToastEvent } from "lightning/platformShowToastEvent";
4
5export default class PostWaveFolders extends LightningElement {
6  folder = {
7    name: "MyTestFolder",
8    label: "My Test Folder",
9  };
10
11  create(event) {
12    postWaveFolders({ waveFolder: this.folder })
13      .then(() => {
14        this.dispatchEvent(
15          new ShowToastEvent({
16            title: "Success",
17            message: "Folder Created",
18            variant: "success",
19          }),
20        );
21      })
22      .catch((error) => {
23        this.dispatchEvent(
24          new ShowToastEvent({
25            title: "Error creating folder",
26            message: error.body.message,
27            variant: "error",
28          }),
29        );
30      });
31  }
32}

This button calls the postWaveFolders() 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>