Business Central 2023 wave 1 (BC22): New customaction types: FlowTemplate and FlowTemplateGallery

Dynamics 365 Business Central

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).

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:

And the MS Learn (Docs) for the CustomActionType Property has also been updated.

ValueAvailable or changed withDescription
Flowruntime version 1.0An action that can trigger a Power Automate Flow.
FlowTemplateruntime version 11.0An action that can trigger a Power Automate template editor to create a new Flow from a specific template.
FlowTemplateGalleryruntime version 11.0An 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).

Let’s take a look at the two new types added this time.

New customaction types: FlowTemplateFlowTemplateGallery:

Add two new CustomActionTypesFlowTemplate 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';
}
PropertyTypeRequired?Description
FlowTemplateIdguidYesThe ID of the template to open.
FlowCaptionstringNoThe 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

2.From https://make.powerautomate.com/templates: 9ab5f3faab684fb2aba256cf85252b74

But it is not in the standard GUID format, we need to simply convert it.
For example, 9ab5f3fa-ab68-4fb2-aba2-56cf85252b74

In BC:

Greate.

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’.

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';
}
PropertyTypeRequired?Description
FlowTemplateCategoryNamestringYesThe category of template to display.
FlowCaptionstringNoThe 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.

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.

Let me do two simple tests.

Email:

Approval:

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.

You can click All templates to display all templates.

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

コメント

Copied title and URL