executeTransition
Overview
Runs a workflow transition on one object or on several objects in one request.
A run that is not a dry run drops the cached workflow state history of each object it ran on, and a history request still in flight for that object does not cache its result. When router and stateToRoute are given and the new state code is a key of stateToRoute, the router then navigates to that route.
Signature
executeTransition(app, model, objectPk, transitionCode, router, stateToRoute, dryRun, acknowledgeWarnings)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| app | string | yes | Django app label. |
| model | string | yes | Model name. |
| objectPk | string | string[] | yes | The object's primary key, or an array of keys for a bulk run. |
| transitionCode | string | yes | The code of the transition to run. |
| router | Router | no | The router to navigate with after the run. |
| stateToRoute | object | no | The route to navigate to for each new state code. |
| dryRun | boolean | no | Whether the server validates the transition and rolls it back. |
| acknowledgeWarnings | string | no | The warning digest the user acknowledged, sent in the Acknowledge-Warnings header. |
Returns
Promise
A promise for the server response. A bulk run resolves to one result per primary key. It resolves to an empty array when workflow is off. It rejects with FormValidationError on a 400, ConfirmationRequiredError on a 409, and WorkflowError for other failures.
Source
client/lib/stores/storeWorkflow.js:534