Skip to main content

Document Reopened

Use the Document Reopened trigger to run a flow interactively – in your own session, at the moment a user reopens a document – for Sales and Purchase documents. The flow runs just before the document is reopened, so it can:

  • Prevent the reopen. End the flow with an Error step and the reopen is cancelled with your message.
  • Inform someone. Send an email or a notification – for example to tell the requester that their approval request was rejected.
  • Adjust the document. End the flow with a Set field values step and your values are written onto the document as it is reopened.
  • Reopen it your own way. Turn on Skip standard processing on that step, and the document is saved with your values instead of being reopened – for example to move it to a status of your choice.

Supported documents (pick exactly one table):

  • Sales Header
  • Purchase Header

Typical examples:

  • Reject a custom approval request: the approver clicks Reopen on a Pending Approval order, the document goes back to Open and the requester gets an email.
  • Only let certain users reopen a released purchase order.
  • Clear an approval date field whenever a document is reopened.

What happens when the flow runs​

  1. A user reopens a Sales or Purchase document from the page.
  2. AutoFlow applies your field filters. If the document does not match, the reopen proceeds normally.
  3. The flow runs to the end, synchronously, before the document is reopened:
    • If it ends with an Error step (or any step raises an error), the reopen is cancelled and the user sees the message; the document keeps its status.
    • If it ends with a Set field values step, those values are written onto the document and the reopen continues – the document becomes Open.
    • If that step has Skip standard processing turned on, the document is saved with those values and is not reopened by Business Central – it gets exactly the status the flow set.
    • If it just ends, the reopen continues unchanged.

Only the manual reopen (a user clicking Reopen) fires this trigger – reopens performed automatically by other processes are left untouched.

Documents pending approval​

Business Central normally refuses to reopen a document with status Pending Approval ("The approval process must be cancelled or completed to reopen this document."). When a Document Reopened flow runs for such a document, AutoFlow lifts that block, so your flow decides – this is what makes rejecting a custom approval with Reopen possible.

The block stays in place when Business Central's own approval workflow still has open approval requests for the document. Cancel those in Business Central first; AutoFlow never leaves Business Central's approval entries behind.

note

For purchase documents on Business Central 27 and earlier, Business Central checks Pending Approval before any flow can run, so a pending purchase document cannot be reopened through a flow there. Every other reopen – and every sales document – works on all versions.

Trigger output​

  • Rec – a reference to the document being reopened, so SmartFields can read its fields (e.g. {{<slug>.Rec.Status}}) and follow-up steps can use it. It still shows the status the document had before the reopen – use it to tell a rejected approval (Pending Approval) from an ordinary reopen (Released).

Configure the trigger​

Open the flow editor, pick When a document is reopened (interactive), and complete the card.

Table​

Choose Sales Header or Purchase Header.

The table picker lists every table in the system, but the trigger only works on the tables above. Pick another one and the status line at the bottom of the dialog says so straight away, and the flow cannot be published until you change it. Next to that message sits Ask us to add this table, which sends the request to the AutoFlow team.

Interactive sessions only​

Leave this on (the default) so the flow runs only when a person reopens the document in the client.

Timeout (seconds)​

The flow runs while the user reopens the document, so keep this short.

Field Filters​

Optional. Limit the flow to documents that match certain criteria (for example Status = Pending Approval).

Change the document: Set field values​

End the flow with the Set field values step. Add a row per field, type a value (SmartField references supported), and choose Validate (as if typed on the page) or Assign (raw value).

Turn on Skip standard processing when the flow should decide the outcome on its own: the document is saved with your values and Business Central's own reopen does not run. Warehouse requests are then not reopened either.

Ask the user first​

Add a Confirm dialog step to put a yes/no question to the user before the reopen goes ahead – for example "Reject the approval request?". End the No path with an Error step to cancel the reopen.

Build a custom approval​

Together with the Document Released trigger you can run a complete approval without Business Central's approval workflows – see Build a custom approval.