End icon

End

End Node

Overview

The "End" node is designed to signal the completion of a process instance in an automated workflow, typically marking it as either "Approved" or "Rejected." It interacts with an external API to update the state of a business process based on user input. This node is useful in scenarios where you need to programmatically finalize a workflow step and communicate its outcome to another system, such as in approval processes, task management, or automated decision-making pipelines.

Practical Example:
In a loan application workflow, after all checks are completed, this node can be used to mark the application as "Approved" or "Rejected" by sending the final status to an external BPM (Business Process Management) system.

Properties

Name Type Meaning
Type options Determines the final state to set for the process instance: "Approved" or "Rejected".
Business Key hidden The unique identifier for the business process instance. Required for API interaction.
Execution ID hidden The execution identifier for the current workflow run. Required for API interaction.

Output

The node outputs a JSON object with the following structure:

{
  "state": "<Type value>",
  "businessKey": "<Business Key value>",
  "executionId": "<Execution ID value>"
}
  • state: The selected end type ("UpdateStateToApproved" or "UpdateStateToRejected").
  • businessKey: The business key used to identify the process instance.
  • executionId: The execution ID of the current workflow run.

Dependencies

  • External Service: Requires access to https://06.dev.fimple.co.uk/api/v1/Saga/BpmInstances/ for updating the process state.
  • API Authentication: May require appropriate credentials or network access to interact with the external API (not explicitly shown in code).
  • n8n Configuration: The node expects that the "Webhook" node provides a processinstancekey in the headers for the Business Key.

Troubleshooting

  • Missing Business Key or Execution ID: If either the Business Key or Execution ID is missing, the node will not attempt the API call but will still output the parameters. Ensure upstream nodes provide these values.
  • API Errors: If the external API returns an error (e.g., invalid keys, network issues), errors may appear in the n8n logs or console. Check connectivity and credentials.
  • Incorrect Webhook Data: If the "Webhook" node does not supply the expected header, the Business Key will be undefined, causing the API call to fail.

Links and References

Discussion