Export and import Solutions

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 Microsoft Office 365, Microsoft Power Automate image 57

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 Microsoft Office 365, Microsoft Power Automate image 59

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

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 Microsoft Office 365, Microsoft Power Automate image 60

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 Microsoft Office 365, Microsoft Power Automate image 61

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 Microsoft Office 365, Microsoft Power Automate image 64

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 Microsoft Office 365, Microsoft Power Automate image 65

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 Microsoft Office 365, Microsoft Power Automate image 66

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.

One thought 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

Leave a Reply

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

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 4,912 other subscribers

Recent Posts

Archive

Thank you for visiting SharePains

%d bloggers like this: