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
Table of Contents
First I want to have a look at two actions available in the Microsoft Dataverse connector.
- Perform a bound action
- Perform an unbound action

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.

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.

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?

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.

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.

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

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

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.
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
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?
I haven’t tried this with Dataverse for Teams.
Help please, how to importSolution when i get zip file from sharepoint ? What formula a need to put in CustomizationFile ?
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.
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 ???
That is the CustomizationFile that comes out of the Export action.
I can’t access or get this file since I separate the import flow in the production environment, any clarification please.
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.
is there a way to import a solution to dataverse for teams via dlows?
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.
How can we import a solution and set all flows within off ?
You could pause all flows in a similar way as described in this post:
https://sharepains.com/2020/12/02/re-enable-flows-power-automate/
So if you had one scheduled flow that starts on deployment that disables all flows then that might work.
Is there anyway to automate the connection refresh..?
Not as far as I’m aware
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!
Yes, it could be two separate flows.
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.
Does the import work successfully when you import it using the Power Platform UI?