Skip to content

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 ​

NameTypeRequiredDescription
appstringyesDjango app label.
modelstringyesModel name.
objectPkstring | string[]yesThe object's primary key, or an array of keys for a bulk run.
transitionCodestringyesThe code of the transition to run.
routerRouternoThe router to navigate with after the run.
stateToRouteobjectnoThe route to navigate to for each new state code.
dryRunbooleannoWhether the server validates the transition and rolls it back.
acknowledgeWarningsstringnoThe 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