updateRecipeNotification

Updates the notification settings for a specific data prep recipe by ID.

Syntax 

1import { updateRecipeNotification } from 'lightning/analyticsWaveApi';
2updateRecipeNotification({ id: string, recipeNotification: RecipeNotificationInput }): Promise<RecipeNotification>

Data Prep Recipe API Resource 

1PUT /wave/recipes/${id}/notification

updateRecipeNotification uses this Data Prep Recipe API resource.

Parameters 

Parameter NameTypeDescriptionRequired?
idStringThe ID of the recipe.Yes
recipeNotificationObjectThe recipe notification to update. Use a Recipe Notification Input resource.Yes

Returns 

Usage 

Use updateRecipeNotification to allow users to change recipe alert timings, notification levels, and more. This example adds an update button to a page with recipes. The page must contain form elements for the information required to update the notification, like the alert timing. To display a toast message when updating a recipe notification, use the lightning/platformShowToastEvent module.

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

This button calls the updateRecipeNotification() method.

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