When implementing approval workflows in Business Central, leveraging Power Automate is highly recommended to maximize efficiency and flexibility. While the built-in templates offer a strong foundation, they come with certain limitations that should be considered. Let's walk through some steps you can take across various Business Central Power Automate approval workflows.
Expressions
As illustrated below, several examples of dynamic content reference the body of the “Get Record” action. This action retrieves all relevant details about the record—in this case, a purchase order—into the flow. However, as you may notice, no additional dynamic content options are available directly under the “Get Record” action.
Without incorporating additional actions, the only way to reference data from the “Get Record” action throughout the flow is by using expressions, such as the one shown in the blue box. If you only need a single additional piece of information, writing one expression is manageable. However, it is likely that multiple fields will be required. Manually creating these expressions repeatedly can be tedious, and even a minor syntax or formatting error can break the workflow.
JSON
From personal experience, if you need more than just the one or two additional dynamic expressions, it’s best to parse the JSON code behind the Get Record action and reference that instead of trying to reference Get Record.
The process for integrating JSON parsing is straightforward. First, add an “Initialize Variable” action immediately following Get Record. The name you assign the variable isn’t vital, but it should be unique to this process, the type has to be Object, and the Value should be dynamic content referencing the Body of the Get Record action, all shown below:
The next step requires a successful test of the flow. Run a test of the flow—Approve or Reject is unimportant, the flow just needs to be successful. In that flow, look at the data in the Body section in the Output section of the Get Record action as shown here. Copy that data and paste it somewhere for temporary storage:
Return to Power Automate and add a “Parse JSON” action immediately after the Initialize Variable action. You’ll need the data that you copied from the successful flow at this point. The content parameter for this action should be dynamic content referencing the variable that was created in the previous action as shown below:
To generate the schema, click on “Use sample payload to generate schema”. Copy the output body data and paste it in this screen:
If the data was pasted successfully, the schema should look like this at the action screen:
You should be able to use the dynamic content that this exposes immediately. To test this, go to an action that generally has dynamic content originating from “Get Record” and look for the “Parse JSON” action as shown here:
Add whatever fields you want to test then save and run your flow. If you can’t see the new dynamic content confirm a) that the field contained data in Business Central and b) that you copied and pasted the schema information correctly.
Expanding This Approach to Other Workflows
While this example focuses on purchase orders, this technique has been successfully applied across various Business Central Power Automate approval workflows. Understanding where data is stored, how to retrieve it, and how to make it readily accessible is crucial for optimizing Power Automate workflow templates.