Preview Instant Flow steps in Business Process Flows

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. Until now, steps could only be used to enter information or run actions in the Common Data Service.

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

 

Add an instant flow as a step in a business process

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

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

To do this we will:

  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

Step 1: Build the instant flow

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

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 to ‘Lead to Opportunity Sales Process’. Finally, we’ll add a text input field to capture a link to the proposal:

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 paste the following content in 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"
                }
            }
        }
    }
}

 

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:

Now that we have the data we need, 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 Get record action to add 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

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.

 

 

 

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:

 

Step 2: 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:

Next, click on 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, click the Apply button at the bottom of the properties pane:

Finally, click 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 clicking on the Run Flow button: