Automatically Advance a Business Process Flow Stage with an Asynchronous Workflow in Dynamics 365

Objective — Automatically reopen a record’s Business Process Flow (BPF) and set it to a specific stage as soon as a flag on the parent record changes, using only a background workflow (no code, no ribbon commands).

1 · Sample scenario

ElementSample valueYour replacement
Main tablenew_project (Project)Your entity
BPF name (display)Project Lifecycle FlowYour BPF name
BPF table (schema)new_projectlifecyclebpfYour BPF table
Trigger fieldExisting Contract? (new_contractflag)Boolean / option set
Target stageReview CompletedDesired stage

2 · Build the background workflow

  1. Find the BPF table: Advanced Find  →  Look for Business Process Flows. Locate Project Lifecycle Flow; note its schema name (new_projectlifecyclebpf).
  2. Create workflow:
    • Process name: Move BPF to Review Completed
    • Category: Workflow
    • Entity: new_projectlifecyclebpf
    • Run this workflow in the background
    • Scope: Organization
  3. Start when → Process changes.
    Expand Project Lifecycle Flow ▸ Project (new_project) and tick Existing Contract? only.
  4. Add a Check Condition:
    If Project (new_project)  Existing Contract?  Equals  Yes
  5. Inside the If → Update Current BPF row.
    Set Active Stage = Review Completed.
  6. Activate the workflow.

3 · What happens at runtime

  1. User sets Existing Contract? to Yes on a Project record and clicks Save.
  2. The background workflow runs against the linked Project Lifecycle Flow row.
  3. The BPF is auto-activated (if needed) and its Active Stage becomes Review Completed.
  4. After a few seconds, refreshing the form shows the header on the new stage.

4 · Tips & cautions

  • Primary Entity must be the BPF table. Only the BPF row exposes the Active Stage field.
  • Background workflows only — real-time workflows cannot change Active Stage.
  • The update also auto-sets statecode to Active if the BPF row was inactive.
  • Users must refresh (or wait for Dynamics’ header poll ≈ 10 s) to see the change.
    Need instant feedback? Add
    setTimeout(() => formContext.data.refresh(false), 3000); to the form’s OnSave.

5 · Result

With one no-code background workflow your process stays perfectly aligned with key data: as soon as the flag flips, the Business Process Flow jumps to the required stage—no plug-ins, no JavaScript, just configuration.

No comments:

Post a Comment