Hi, Readers.
Dynamics 365 Business Central 2023 wave 1 (BC22) is generally available this month. More details: Dynamics 365 Business Central 2023 release wave 1 (BC22)
I will continue to test and share some new features that I hope will be helpful.
Yesterday we briefly discussed New approval workflow experience with Power Automate templates in Business Central 2023 wave 1 (BC22).
![](https://yzhums.com/wp-content/uploads/2023/04/Snipaste_2023-04-26_10-59-09-1024x512.png)
In this post, I would like to talk about two new customaction types, FlowTemplate and FlowTemplateGallery.
This is mentioned in AL Language extension changelog version 11.0:
![](https://yzhums.com/wp-content/uploads/2023/04/image-337-1024x646.png)
And the MS Learn (Docs) for the CustomActionType Property has also been updated.
![](https://yzhums.com/wp-content/uploads/2023/04/image-338.png)
Value | Available or changed with | Description |
---|---|---|
Flow | runtime version 1.0 | An action that can trigger a Power Automate Flow. |
FlowTemplate | runtime version 11.0 | An action that can trigger a Power Automate template editor to create a new Flow from a specific template. |
FlowTemplateGallery | runtime version 11.0 | An action that can trigger a Power Automate template gallery to create a new Flow from a selection of templates. |
As you might know, with Business Central 2022 release wave 2, it’s possible to define page actions that trigger a Power Automate instant flow by using custom actions. For a customaction
, the CustomActionType Property must be set to Flow
. The FlowId Property and the FlowEnvironmentId Property must specify the IDs of the flow and the environment of the flow. More details: Run Power Automate flows from page actions
We have also discussed before, How to manually add new Power Automate (Flow) action from VS Code (Flow Id and Flow Environment Id).
![](https://yzhums.com/wp-content/uploads/2022/11/Snipaste_2022-11-30_15-25-03-1024x592.png)
Let’s take a look at the two new types added this time.
New customaction
types: FlowTemplate
, FlowTemplateGallery
:
Add two new CustomActionTypes
, FlowTemplate
and FlowTemplateGallery
. The actions trigger web the client to open the Power Automate integration to create a new Power Automate flow from a specifc template or selection of templates.
FlowTemplate
Opens the Power Automate template wizard. The user can follow the wizard to create a flow using the specified template.
customaction(DirectAction)
{
CustomActionType = FlowTemplate;
FlowTemplateId = '69569e22-054f-4577-870a-e905860e4319';
FlowCaption = 'My New Flow';
}
Property | Type | Required? | Description |
---|---|---|---|
FlowTemplateId | guid | Yes | The ID of the template to open. |
FlowCaption | string | No | The default caption of the newly created flow. |
First let’s see where we can get this Template ID.
1. From https://powerautomate.microsoft.com/en-us/templates/: 9ab5f3faab684fb2aba256cf85252b74
![](https://yzhums.com/wp-content/uploads/2023/04/image-339-1024x647.png)
2.From https://make.powerautomate.com/templates: 9ab5f3faab684fb2aba256cf85252b74
![](https://yzhums.com/wp-content/uploads/2023/04/image-340-1024x626.png)
But it is not in the standard GUID format, we need to simply convert it.
For example, 9ab5f3fa-ab68-4fb2-aba2-56cf85252b74
![](https://yzhums.com/wp-content/uploads/2023/04/image-341-1024x532.png)
In BC:
![](https://yzhums.com/wp-content/uploads/2023/04/image-342-1024x600.png)
Greate.
![](https://yzhums.com/wp-content/uploads/2023/04/image-343-1024x600.png)
Source Code:
pageextension 50101 ZYItemListExt extends "Item List"
{
actions
{
addfirst(processing)
{
customaction("Flow Template Action")
{
CustomActionType = FlowTemplate;
FlowTemplateId = '9ab5f3fa-ab68-4fb2-aba2-56cf85252b74';
FlowCaption = 'Flow Template Action';
ApplicationArea = All;
}
}
}
}
PS: If the FlowTemplateId is wrong, the following error will be prompted.
The template ‘9ab5f3faab684fb2aba256cf85252b79’ could not be found in gallery ‘public’.
![](https://yzhums.com/wp-content/uploads/2023/04/image-344-1024x600.png)
FlowTemplateGallery
Opens the Power Automate template gallery, filtered to a specific category. The user can follow the wizard to create a flow using a template selected from the gallery.
customaction(DirectAction)
{
CustomActionType = FlowTemplateGallery;
FlowTemplateCategoryName = 'd365bc_instant';
FlowCaption = 'My New Flow';
}
Property | Type | Required? | Description |
---|---|---|---|
FlowTemplateCategoryName | string | Yes | The category of template to display. |
FlowCaption | string | No | The default caption of the newly created flow. |
You can find Flow Template Category Name in Power Automate -> Templates. For example, Remote work, Approval, Email, etc.
![](https://yzhums.com/wp-content/uploads/2023/04/image-350-1024x600.png)
PS: This is the category selected when submitting the template). More details: Submit a template to the Power Automate gallery
‘d365bc_instant’ in the example provided by Microsoft belongs to the Custom categories.
![](https://yzhums.com/wp-content/uploads/2023/04/template-options-431x1024.png)
Let me do two simple tests.
Email:
![](https://yzhums.com/wp-content/uploads/2023/04/image-347.png)
![](https://yzhums.com/wp-content/uploads/2023/04/image-346-1024x600.png)
Approval:
![](https://yzhums.com/wp-content/uploads/2023/04/image-349.png)
![](https://yzhums.com/wp-content/uploads/2023/04/image-348-1024x600.png)
Source Code:
pageextension 50101 ZYItemListExt extends "Item List"
{
actions
{
addfirst(processing)
{
customaction("Flow Template Gallery Action")
{
CustomActionType = FlowTemplateGallery;
FlowTemplateCategoryName = 'Approval';
FlowCaption = 'Flow Template Gallery Action';
ApplicationArea = All;
}
}
}
}
PS: If not found, the following information will be displayed.
We couldn’t find any templates that matched your search.
![](https://yzhums.com/wp-content/uploads/2023/04/image-345-1024x600.png)
You can click All templates to display all templates.
![](https://yzhums.com/wp-content/uploads/2023/04/image-351-1024x600.png)
![](https://yzhums.com/wp-content/uploads/2023/04/image-352-1024x600.png)
Very nice, give it a try!!!😁
PS: Get started with more sample Power Automate templates and Power Apps
END
Hope this will help.
Thanks for reading.
ZHU
コメント