共用方式為


Instant flows in business process flows (Public Preview)

Important

This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.

Business process flows provide a guided way to get work done in the form of stages and steps. Stages tell you where you are in the process, while steps are action items that lead to a desired outcome. Previously, steps could only be used to enter information or run actions in Common Data Service.

With this preview, you can now run an instant flow to automate repetitive tasks, generate documents, track approvals, and more, from inside a stage in the business process.

Runtime

Add an instant flow as a step in a business process

Let’s say that you sell printers to enterprises, and to help close deals, you use the Lead to Opportunity Sales Process:

Designer

As part of this process, you’d like to have the team lead review and approve proposals put together by the sales team in the Propose stage of the business process flow before sharing it with the customer.

Follow these steps do this:

  1. Build a solution-aware instant flow that requests review and approval of the proposal from the team.
  2. Add this flow as a step in the Lead to Opportunity Sales Process.

Build the instant flow

Only solution-aware flows can be added as a step in a business process. In the example, create an instant flow in the Default Solution. To do this, select Solutions in the navigation menu, select Default Solution in the list of solutions to open it, and then create a flow in this solution from the + New menu.

Solution flow

In this version of the preview, begin by adding the When a record is selected trigger from the Common Data Service connector. Set the Environment field to Default and set Entity Name to Lead to Opportunity Sales Process. Finally, add a text input field to capture a link to the proposal:

Trigger

Next, we can get information from the business process flow instance to help provide context for the review. In this version of the preview, we do this by adding the Parse JSON action. Set the Content field to entity by selecting it from the list of dynamic values of the trigger and then paste the following content into the Schema field:

{
  "type": "object",
    "properties": {
        "entity": {
            "type": "object",
            "properties": {
                "FlowsWorkflowLogId": {
                    "type": "string"
                },
                "BPFInstanceId": {
                    "type": "string"
                },
                "BPFInstanceEntityName": {
                    "type": "string"
                },
                "BPFDefinitionId": {
                    "type": "string"
                },
                "BPFDefinitionEntityName": {
                    "type": "string"
                },
                "StepId": {
                    "type": "string"
                },
                "BPFDefinitionName": {
                    "type": "string"
                },
                "BPFInstanceName": {
                    "type": "string"
                },
                "BPFFlowStageLocalizedName": {
                    "type": "string"
                },
                "BPFFlowStageEntityName": {
                    "type": "string"
                },
                "BPFFlowStageEntityCollectionName": {
                    "type": "string"
                },
                "BPFFlowStageEntityRecordId": {
                    "type": "string"
                },
                "BPFActiveStageId": {
                    "type": "string"
                },
                "BPFActiveStageEntityName": {
                    "type": "string"
                },
                "BPFActiveStageLocalizedName": {
                    "type": "string"
                }
            }
        }
    }
}

Use entity

Since the Propose stage of our business process is defined on the Opportunity entity, let’s get information from the related Opportunity record to provide additional context in the approval requests. To do this, add the Get record action of the Common Data Service connector. Set the Environment to (Current), the Entity Name to Opportunities, and the Item Identifier to BPFFlowStageEntityRecordID, picked from the list of dynamic values:

Use JSON

Now that we have the data, lets define the approval process by adding the Start and wait for an approval (V2) action. Use the dynamic content picker to add fields from the Get record action to add the relevant information about the Opportunity. To provide further context of the active stage that the business process is in, select the BPFActiveStageLocalizedName field from the list of dynamic values.

Localized information

Next, let’s send an email to the requestor based on the outcome of the approval. To do this, add a condition based on the Outcome field of the approval (picked from the list of dynamic values) and add a Send an email action to both the If yes and If no paths.

Branch

Finally, save the flow and turn it on. Altogether, our flow that requests an approval with information from the business process and the related opportunity record, and acts based on the outcome is below:

Overview

Add an instant flow as a step in a business process

We begin by opening the Lead to Opportunity Sales Process in the BPF designer. To add a flow as a step in the Propose stage of our BPF, simply drag and drop the Flow Step (preview) component onto the Propose stage:

Drag step

Next, select the search icon in the Select a Flow field to list all flows that can be added to a BPF, and select one from the list. To save your changes, select the Apply button at the bottom of the properties pane:

Pick

Finally, select the Update button to make this business process flow with its new flow step available to users.

And we’re done! You can now run your flow from the Propose stage of the Lead to Opportunity Sales Process by selecting the Run Flow button:

Final