Skip to main content

Dynamics 365 Business Central: Power Automate environment selection and permissions

Until Dynamics 365 Business Central version 21.X, Power Automate flows that show up in the Automate group in a Business Central page were always sourced from the default (or first) Dataverse environment. 

With Dynamics 365 Business Central 2023 Wave 1 release (version 22), a user can now select a Dataverse environment in the context of the Automate group and access flows stored in that Dataverse environment. To do that, simply go to the Assisted Setup page and from here execute the Power Automate Environment wizard:

This wizard allows you to explicitly choose which Dataverse environment to use for the Automate feature, providing all the flexibility you need as a user or maker. From the wizard you can select the environment you want from a list of environments your user has access:

The selected Power Automate environment will be now used for flows shown as actions in the Automate group and when you are adding new or managing already created workflows. Please remember that this change applies only to the current user; other users will still use their preferred Dataverse environment, or the default one if they didnā€™t make a decision.

But what about userā€™s permissions? Can this be controlled by permisssions?

There are two types of permissions that control the Automate behavior:

  • The system permission included in the Automate ā€“ Exec permission set controls whether the user can use the Automate group in the client.
  • The tabledata permission for Flow User Environment Config table (Id = 1545) controls whether the user can set (or get) a custom environment for the Automate action. This permission is actually included in almost all out of the box permission sets.

Be aware of that structure, because sometimes you can have unexpected behaviors.

An example: if user A has the Automate ā€“ Exec permissions assigned, but he has no permissions for Flow User Environment Config tabledata, he can see the Automate action group in the UI but he cannot have a custom environment. In this case the Automate action group will be visible but the displayed Power Automate flows will be the flows connected to the default Dataverse environment.

A feature that allows administrators to set a Dataverse environment for all users in a Business Central tenant is on the roadmap, maybe in a future minor update.

Thereā€™s also a thing to be aware of related to this topic. When you create a Power Automate flow in an environment and then you export it to another environment, the Power Automate flow maintains the same ID.

In an AL extension you can create custom actions via code for triggering a specific Power Automate flows in the following way:

where FlowId is the ID of the Power Automate flow to call.

In this custom action you can also specify the FlowEnvironmentId parameter, that identifies which environment the flow belongs to:

If you specify an action with a FlowEnvironmentId, the action will only be enabled when Dynamics 365 Business Central is connected to the specified Dataverse environment. If the user is connected to a different environment than the one specified by FlowEnvironmentId then the action will be disabled.

If you do not set the FlowEnvironmentId property, Dynamics 365 Business Central will look for the flow in the userā€™s currently selected environment.

This means that you should be careful when using the FlowEnvironmentId property.

Comments

*This post is locked for comments