Skip to main content

Process Flows

The method getFlowService of a SpiffCommerceClient can be called to acquire a FlowService that can be used to initiate process flow executions.

The execute method takes a process flow ID and a list of FlowExecutionInput objects which must correspond to the input nodes of the given flow.

Each FlowExecutionInput is either:

  • A TextInput;
  • An ObjectInput for Spiff entities such as bundles; or
  • An ArrayInput.

The execute method returns a FlowExecutionNodeResult, whose method getArtifacts returns a map of the data attached to the execution's output node.

const flowService = client.getFlowService();
const processFlowId = "00000000-0000-0000-0000-000000000000";
const inputs = [
new TextInput("example"),
new ObjectInput("00000000-0000-0000-0000-000000000000", ObjectInputType.Bundle),
new ArrayInput([new ObjectInput("00000000-0000-0000-0000-000000000000", ObjectInputType.Transaction)]),
];
const executionResult = await flowService.execute(processFlowId, inputs);
const artifacts = executionResult.getArtifacts();