updateSchedule

CRM Analytics データプレップレシピ、データ同期、またはデータフローのスケジュールを更新します。

構文 

1import { updateSchedule } from 'lightning/analyticsWaveApi';
2updateSchedule({ schedule: { assetId: string, schedule: ScheduleInput } }): Promise<Schedule>

CRM Analytics API リソース 

1PUT /wave/asset/${assetId}/schedule

updateSchedule は、この CRM Analytics API リソースを使用します。

パラメータ 

  • assetId — (必須) データフロー、レシピ、またはデータ同期の ID。
  • schedule — (必須) データフロー、レシピ、またはデータ同期について作成または更新するスケジュール。Schedule Input を使用します。スケジュールは 1 時間ごと、1 週間ごと、1 か月ごと (相対的)、1 か月ごと (特定の日付)、イベントベースです。

戻り値 

  • Schedule 応答を使用して解決される Promise オブジェクト。

使用方法 

updateSchedule を使用するには、いくつかの方法があります。たとえば、レシピまたはデータフローのリストを表示し、実行スケジュールをユーザが更新できるようにすることができます。

次の例では、レシピが含まれるページにスケジュールボタンを追加します。レシピのスケジュールを設定すると、lightning/platformShowToastEvent モジュールを使用して、トーストメッセージが表示されます。ユーザがスケジュール種別と属性を選択できるように UI を含める必要があります。次の例では、1 時間ごとのスケジュールを前提としています。

1import { LightningElement, api } from "lwc";
2import { updateSchedule } from "lightning/analyticsWaveApi";
3import { ShowToastEvent } from "lightning/platformShowToastEvent";
4
5export default class UpdateSchedule extends LightningElement {
6  @api assetId; // or fetch the ID of the asset
7  hourlySchedule = {
8    daysOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
9    lastHour: 20,
10    hourlyInterval: 3,
11    time: {
12      hour: 2,
13      minute: 30,
14      timeZone: "America/Los_Angeles",
15    },
16    frequency: "hourly",
17  };
18
19  schedule(event) {
20    updateSchedule({ assetId: this.id, schedule: this.hourlySchedule })
21      .then(() => {
22        this.dispatchEvent(
23          new ShowToastEvent({
24            title: "Success",
25            message: "Schedule updated",
26            variant: "success",
27          }),
28        );
29      })
30      .catch((error) => {
31        this.dispatchEvent(
32          new ShowToastEvent({
33            title: "Error updating schedule",
34            message: error.body.message,
35            variant: "error",
36          }),
37        );
38      });
39  }
40}

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

1<template>
2  <lightning-button
3    label="Schedule"
4    icon-name="utility:date_time"
5    icon-position="right"
6    onclick={schedule}
7  ></lightning-button>
8</template>

The Japanese Summer '24 guide is now live

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