Define custom actions in AL code

Important

This content is archived and is not being updated. For the latest documentation, go to What's new and planned for Dynamics 365 Business Central. For the latest release plans, go to Dynamics 365 and Microsoft Power Platform release plans.

Enabled for Public preview General availability
Admins, makers, marketers, or analysts, automatically Sep 1, 2022 Oct 1, 2022

Business value

Pages in Business Central can have actions that are used to run objects such as other pages, reports, or codeunits. All of these objects are native to Business Central. However, there's an increasing need to be able to invoke external targets. To support this, a new custom action has been added. For now, it will be possible to invoke Power Automate flows only, but in the future, custom actions could be used to invoke Power BI reports, Power Apps, or websites in the context of a given Business Central page, for example.

Feature details

Custom actions are defined next to other than actions, but use the customaction keyword instead. A custom action has a type, and in this release, only Flow is supported. Depending on the type, additional properties might apply. For now, FlowId and FlowEnvironmentId will be available. These properties make up the target flow identity, allowing the client to trigger the flow when the custom action is invoked.

Example:

customaction(MyFlowAction)
{
    CustomActionType = Flow;
    FlowId = '<the-GUID-identifying-the-Power-Automate-Flow>';
    FlowEnvironmentId = '<the-GUID-identifying-the-Power-Automate-environment>';
}

See also

Actions Overview (docs)