updateDataflowJob

Updates a CRM Analytics dataflow job, which is the equivalent of clicking Stop for a data prep recipe, a data sync, or a dataflow in the Tableau CRM Data Manager UI.

Syntax 

1import { updateDataflowJob } from 'lightning/analyticsWaveApi';
2updateDataflowJob({ dataflowjobId: string, dataflowJob: { command: string } }): Promise<DataflowJob>

CRM Analytics API Resource 

1PATCH /wave/dataflowjobs/${dataflowjobId}

updateDataflowJob uses this CRM Analytics API resource.

Parameters 

Parameter NameTypeDescriptionRequired?
dataflowjobIdStringThe dataflow job ID.Yes
commandStringThe job command to execute.
  • start
  • stop
Must be stop to update a dataflow job.
Yes

Returns 

  • A Promise object that resolves with the Dataflow Job response.

Usage 

There are several ways to use updateDataflowJob. For example, you can display a list of dataflow jobs and enable stop on each queued or running recipe on the list.

This example adds a stop button to a page with recipes. Stopping a recipe displays a toast message using the lightning/platformShowToastEvent module.

1import { LightningElement, api } from 'lwc';
2import { updateDataflowJob } from 'lightning/analyticsWaveApi';
3import { ShowToastEvent } from 'lightning/platformShowToastEvent';
4
5export default class UpdateDataflowJob extends LightningElement {
6  @api dfjobId; // or fetch the ID of the dataflow job
7  command = 'start';
8
9  stop(event) {
10    updateDataflowJob({ dataflowjobId: this.dfjobId, dataflowJob: { this.command } })
11      .then(() => {
12        this.dispatchEvent(
13          new ShowToastEvent({
14            title: 'Success',
15            message: 'Recipe job stopped',
16             variant: 'success'
17                    })
18          );
19        })
20        .catch(error => {
21          this.dispatchEvent(
22            new ShowToastEvent({
23              title: 'Error stopping recipe job',
24              message: error.body.message,
25              variant: 'error'
26            })
27          );
28        });
29  }
30}

This button calls the updateDataflowJob() method.

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