updateRecipeNotification

特定のデータプレップレシピの通知設定を ID で更新します。

構文 

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

データプレップレシピ API リソース 

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

updateRecipeNotification は、このデータプレップレシピ API リソースを使用します。

パラメータ 

  • id — (必須) レシピの ID。
  • recipeNotification — (必須) 更新するレシピの通知。Recipe Notification Input リソースを使用します。

戻り値 

使用方法 

ユーザは、updateRecipeNotification を使用することで、レシピアラートのタイミングや通知レベルなどを変更できます。次の例では、レシピが含まれるページに更新ボタンを追加します。ページには、アラートのタイミングなどの通知の更新に必要な情報のフォーム要素が含まれている必要があります。レシピ通知の更新時にトーストメッセージを表示するには、lightning/platformShowToastEvent モジュールを使用します。

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}

このボタンは、updateRecipeNotification() メソッドをコールします。

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>

The Japanese Summer '24 guide is now live

日本語の Summer '24 ガイドが公開されました! 「Component Reference (コンポーネントリファレンス)」は、以前と同様にコンポーネントライブラリにあります。