December 19, 2024

One of the coolest features of Microsoft’s Flow is the ability of export and import a flow as a template. You can easily share complete and complex flows in a file with anyone.

Microsoft provides a great list of templates, but you can create your own and share them like I’m doing here.

In the following sections, I’ll explain how to create a template, the contents of the exported file, and how to import it.

Creating a Template

Just choose the flow you want to export and click the Export dropdown:

You can get it also from the Flow’s details page:

There are two ways to export the flow:

  1. Package (.zip)
  2. Logic Apps Template (.json)

We’ll focus on the package option. I’ll explore the Logic Apps Template in future articles.

Pick the Package option:

There a few things to take in consideration:

  1. You can name the flow anything. The user can choose the name in the import process.
  2. Remove the Environment. If the users are within the same company, this may not be an issue since they share the same environment, but if they don’t then the default value will be an environment that doesn’t exist for that user. If the value is missing, the import process will import the flow to your default environment.
  3. Import Setup. You have the option to say that you want to import the package as an update to an existing flow or as a new one. You can change these options in the import process, but I recommend using the New, even if the Update is the default option.

Importing as new will have several advantages:

  1. The user may override a current flow with the same name by accident.
  2. If the user wants to override a flow, he/she needs to select it explicitly.
  3. New is (in my opinion) the most frequent option and should be the default one.

Just click Export, and you’ll get a sharable .zip file.

 

File contents

The file is relatively technical so that I won’t go into much detail about its content. You’ll only need to open it in rare cases like this one, but here is a high-level description of the contents of the file.

Here are the packaged objects:

  1. Flow’s steps – The export process will wrap all steps and connections contained in the package.
  2. Connections – The export process will package the connections’ necessary information without the credentials or locations.
  3. Flow’s metadata – The information that you filled-in above
  4. PowerApps – Any created PowerApp.

The process won’t package:

  1. Custom connectors. You need to re-create them manually before importing the new flow.
  2. Connections. The export process won’t include in the package any connections that need credentials. It will keep only the necessary information so that you can re-map it in the import process.
  3. Roles and Permission. The export process won’t include any roles or permissions in the package. The user will create them manually after they import the package.

Importing a template

To import a template is even simpler. Just select Import in the main screen and select the .zip file.

The import process will now upload the file and parse it. You’ll be able to check the details of the import process in the following screen.

The import process will fill in the fields based on the package’s data, but you can rename any of them as needed.

You will also need to map the exported connections. The import process will help you in this by flagging the missing ones on a screen like this:

A new screen will display the existing or provide you the possibility to create a new one:

To finalize just press Import. The new Flow will appear in your flow list.

 

Limitations

  1. Currently, you cannot re-map connectors. For instance, if you’re using a SharePoint list connection, you cannot change it to a SQL Server table.
  2. The export utility can’t, for now, export any custom connectors. If you want to re-use them, you need to create them again.
  3. You need to re-add any roles to the new flow. The export utility won’t include then in the package file.

References

Have a suggestion of your own or disagree with something I said? Leave a comment or interact on Twitter and be sure to check out my other Flow articles.

Featured Image by chuttersnap on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

6 thoughts on “Power Automate: How to Import a Template

  1. Hi – Thanks so much for your site!
    Is it possible these instructions for importing are out of date? I can’t seem to find a method of successfully importing your templates into an existing solution. I can import them into Flows but not an existing solution. I’m hoping to use TEMPLATEAddattachmentstoemaildynamically_20210413085838. When I attempt to import it as a “solution” (the only “Import” function I can find in Solutions) I get this error. I see that your files are JSON files and not xml. Do you have suggestions?
    Thank you!

    “The solution file is invalid. The compressed file must contain the following files at its root: solution.xml, customizations.xml, and [Content_Types].xml. Customization files exported from previous versions of Microsoft Dynamics 365 are not supported.”

    1. Hi Paul,
      To import a Flow to a solution, I would import it first to “My Flows” and then add it to the solution.
      The Import in the solutions is used to import solutions, so the zip file contains Flows, PowerApps, etc.
      Try the following:
      1. Go to “My flows.”
      2. Import the template. Don’t unzip it. Import it as is.
      3. Go to solutions
      4. Open your solution
      5. Use “add existing.”
      6. Search for the imported Flow and add it to the solution.

      Can you please try and let me know the result?

      Cheers
      Manuel

      1. Hi Manuel, I tried to import the latest flow template you sent me and it failed with this error. Per your instructions I did not unzip it. I’m replying here instead of the relevant blog entry because the “comments” section in that page isn’t displayed.

        The request failed with error: ‘{“error”:{“code”:”PackageFlowMissingConnectionMap”,”message”:”Flow resource ‘4db38da0-6021-4b3e-90b0-09a88837c78d’ missing mapping for connections ‘shared_office365,shared_onedriveforbusiness,shared_excelonlinebusiness’.”}}’. The tracking Id is ‘88147b84-df63-4a9c-9c25-0e41a4582b71’.

        Thanks.

        1. Hi Paul,
          The comments should work. Strange. I’ll take a look.
          Anyway, regarding this, I managed to replicate and generated a new template. I imported it, and it worked, so I think you’ll be able to import it.
          I don’t really know what triggered the issue, but here’s the template
          https://manueltgomes.com/wp-content/uploads/2021/07/PaulFlow_20210701073840.zip

          You should see now the mapping for the 3 connectors:

          Also, if someone else needs to add attachments to email dynamically, here’s the post that Paul is talking about.
          https://manueltgomes.com/microsoft/powerautomate/power-automate-add-attachment-to-e-mail-dynamically/

          I hope this helps, and for anything else, please let me know.
          Cheers
          Manuel

  2. Hi, and thank you for this work. I do not understand what it means to map a new connection when importing a package. I’ve tried many things but couldn’t manage to import the csv parse package you provide. Can you help?

    1. Hi Anthony,
      Sure let’s do this.
      “Map a new connection” refers to the step of the process:
      connection
      We’re saying to Power Automate to use the connection that we have (or if we don’t create one) so that the actions inside the template can work. Think of it as connecting the cables from one side to the other.
      In the case of the CSV template, we need a connection to OneDrive to fetch the CSV file because the template has an action but needs to have a connection to a valid OneDrive account.
      What kind of error are you getting?
      If you prefer, you can also email me at manuel@manueltgomes.com, and I’ll help you further.
      Cheers
      Manuel

Leave a Reply

Your email address will not be published. Required fields are marked *

Mastodon