How to export and import solutions using flows in Power Automate

Have you ever wanted to export and import solutions using a flow? In this post all you need to know to get started.

Perform an unbound action

First I want to have a look at two actions available in the Microsoft Dataverse connector.

  • Perform a bound action
  • Perform an unbound action
How to export and import solutions using flows in Power Automate
How to export and import solutions using flows in Power Automate 1

A bound action is connected to a table in Microsoft Dataverse

An unbound action is not related to a table in Microsoft Dataverse. .

Today it is the unbound actions that I’m going to need.

Perform an unbound action

In the perform an unbound action you will find many options.

The documentation is less than helpful.

How to export and import solutions using flows in Power Automate
How to export and import solutions using flows in Power Automate 2

Export and import solutions

To export and import solutions you can select Export Solution from the Action name drop down and a scary form will appear.

Export and Import solutions
How to export and import solutions using flows in Power Automate 3

Note that you might want to review the export settings, as you might want to export your solutions as managed solutions rather than unmanaged solutions.

And when we run this flow a solution file content is created. within 16 seconds. Have you seen an export happen within 16 seconds lately?

How to export and import solutions using flows in Power Automate
How to export and import solutions using flows in Power Automate 4

Now we can create a file using this exported content.

To get to the content the following expression is needed:

base64ToBinary( Body('Perform_an_unbound_action')?['ExportSolutionFile'])

This could for example create a file in SharePoint.

Just imagine for one moment, you could create a regular export of all your solutions and create a backup of them in SharePoint, or Devops or wherever you like.

How to export and import solutions using flows in Power Automate
How to export and import solutions using flows in Power Automate 5

Import a solution using a flow

Now that we have a valid export, we might want to import the solution.

You can now supply the File content directly from the import, however, you would be more likely to import the solution in a different environment, hence using SharePoint to store the expert file might make sense.

How to export and import solutions using flows in Power Automate
How to export and import solutions using flows in Power Automate 6

Do however remmeebr to supply the ImportjobID, otherwise you will get the following error:

An error occurred while validating input parameters: Microsoft.OData.ODataException: One or more parameters of the operation ‘ImportSolution’ are missing from the request payload. The missing parameters are: ImportJobId.
at Microsoft.OData.ODataParameterReaderCore.EnterScope(ODataParameterReaderState state, String name, Object value)
at Microsoft.OData.JsonLight.ODataJsonLightParameterDeserializer.ReadNextParameter(PropertyAndAnnotationCollector propertyAndAnnotationCollector)
at Microsoft.OData.ODataParameterReaderCore.ReadImplementation()
at Microsoft.OData.ODataParameterReaderCore.InterceptException[T](Func`1 action)
at Microsoft.Crm.Extensibility.ODataV4.CrmODataActionPayloadDeserializer.Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)

The JobId has to be a UUID.

What is a UUID???

Well, all that is needed is a GUID. so we can use the guid() function to generate a unique id for our export and import of solutions

How to export and import solutions using flows in Power Automate
How to export and import solutions using flows in Power Automate 7

And when we review the installed solutions, we can see that our solution has been imported successfully. In only about 30 seconds.

How to export and import solutions using flows in Power Automate
How to export and import solutions using flows in Power Automate 8

So importing and exporting solutions using flows seems to be a lot faster than doing this manually. And it isn’t a bad idea to put a bit of a process ( approval etc) around our export and import solutions process anyway.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Related Posts

19 thoughts on “How to export and import solutions using flows in Power Automate

  1. Hi Pieter
    Is there a way of exporting and Importing a Canvas PowerApp using PowerAutomate Flow ?
    Or should I just put them into solutions and export them and Import then using this technique ?
    Regards
    Nigel

  2. Hi,

    Tried this regarding the export solution step. It works for a blank solution but not one containing apps / flows inside of Dataverse for Teams. Simply says the name cannot be found, I’ve tried all names I can see including the one listed without spaces (unique name). Any ideas?

  3. Help please, how to importSolution when i get zip file from sharepoint ? What formula a need to put in CustomizationFile ?

    1. So when you read the file from sharepoint using a get file content, you will need to use the base64 functions to convert the content. In the post you can see an example of the reverse conversion.

      1. Please Can you tell me What is formula I need to put in [CustomizationFile] input in the import flow that I have to made in the production environment ???

      2. I can’t access or get this file since I separate the import flow in the production environment, any clarification please.

      3. So you could get the export flow to save the file somewhere and then get the import flow to first read the content before using it in the action that does the import.

    1. I haven’t tried it, but as you can create solutions by going to the solutions URL and replace the GUID of the environment. You should also be able to use the export/import as described in this post.

  4. Are we Creating two different flows here? The first export in one environment and import in another environment(target).
    In that case, does adding the file to sharepoint doc library trigger the second flow?
    Thanks!

  5. During Import setting CustomizationFile = ExportSolutoinFile from output of Export Solution , not importing all the solution components.

    Ex”: I had the setting definition “Hide the nav bar” in my solution in source environment. Exported the solution and created the file .zip in Share point worked. Manually verified that .zip includes the setting definition.

    After importing the solution to target environment ,the solution is empty.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.