It’s useful to extend the existing functionality of your Business Process Flow (BPF) and include automations in the form of a flow. Some things are worth keeping in mind when you incorporate a Flow. Let’s take a look in this first part on how to create the BPF.
In this example, the flow will send an e-mail to the lead in the BPF called “Lead Management”.
Create the flow
We go to Powerapps portal to create a flow. Be aware you create the flow in the same solution where your BPF is located to be able to use it in your BPF.
In the end the flow looks like this for our case:
Let’s drill down into the most important parts:
Trigger
Important to note is that our Flow is an instant flow. This means the flow will start when the trigger is accomplished. Select the correct entity, in our case our BPF called “Lead Management”.
Be sure, when your flow needs some parameters to pass to the rest of the flow, you can select additional ones like I did here with the Email Subject. A user will be prompted when he triggers the flow to fill in the required parameters.
Parse JSON
When we use a BPF entity, the record information is passed in JSON format. The trick here is to gather the schema definition by running the flow one time as a test. Here you will be able to find out which scheme is used and this way you can copy-paste this in the Parse JSON function.
Just to help you out, I’ll provide the scheme:
{ "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" } } } } }
Now you should be able to use the record information passed into the entity parameter thanks to the parsing of the json.
Set Succeeded
To help the end-user indicate the flow has run succesfully, we need to identify the Process log record associated with the current active BPF stage workflow id. To do this, we need to mark the process log as Succeeded. If this isn’t the case, your BPF will think the flow is still running.
Keep tuned for Part 2, where I will bring the flow to the BPF.