Power Automate

Simplify Flow Settings With A Config File In Power Automate Desktop

Simplify Flow Settings With A Config File In Power Automate Desktop Posted by - Matthew Devaney on - September 22, 2024 2 Comments A Power Automate Desktop c...

Matthew Devaney
Published
Reading time
3 min read

Before you start

Is this guide for you?

Best entry point
Power Automate
Time investment
3 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/simplify-flow-settings-with-a-config-file-in-power-automate-desktop/. Author: Matthew Devaney.

Simplify Flow Settings With A Config File In Power Automate Desktop Posted by - Matthew Devaney on - September 22, 2024 2 Comments

A Power Automate Desktop config file holds configuration data used by a desktop flow . It allows the developer to store settings separately from the automation logic. Configuration data remains constant throughout all flow runs. If it becomes necessary to update the config file, a developer can do so without changing the automation itself. Table of Contents Create A JSON File On The Machine

Read The Config File In Power Automate Desktop

Convert JSON Config File To A Custom Object

Select A Value In The Config Custom Object Create A JSON File On The Machine

The Power Automate desktop config file we will build is a JSON file that stores all of the necessary flow settings. Open Windows Explorer, make a new folder for the Sales Tax Report automation and create a text document file (txt) inside the folder. Rename the document and change the extension to SalesTaxReport-ConfigFile.json .

Open the config file in a text editor such as VSCode or Windows Notepad .

Then copy and paste this JSON object into the JSON file. A JSON object must be structured as a series of key-value pairs within curly brackets. The JSON below includes string, number and boolean values. We can also use objects, arrays and nulls as values though they are less common. {

"File Location" : "C:Power AutomateSales Tax ReportAll Company Sales.xlsx" ,

"Business Owner Email" : " [email protected] " , "Sales Tax Rate" : 5.5 , "Enable Notifications" : true } Code language: JSON / JSON with Comments ( json )

Read The Config File In Power Automate Desktop

The first action a Power Automate Desktop flow performs should be to get the configuration data and stores the values in a custom object (variable). Open Power Automate Desktop and create a new flow.

Add a read text from file action and populate the file path with the JSON config file path. Store the content as a single text value. Change the variable produced to ConfigFileContents .

Convert JSON Config File To A Custom Object

To use values stored in the config file we need to convert the JSON string into a custom object variable. Insert the convert JSON to custom object action into the flow. Update the variable produced to ConfigValues .

Write this expression in the JSON field of the action to load the JSON string. %ConfigFileValues%

When we run the desktop flow we can see the configuration data loaded into the ConfigValues variable.

Select A Value In The Config Custom Object

Now that the config file values are stored in a custom object we can use them in a desktop flow. For example, we could show the file location in a message box. Add a display message action to the flow with the title “Test Message.”

Write this expression in the Message To Display field to show the file location. The “key” written inside of the square brackets tells Power Automate Desktop which value retrieve. % ConfigValues [ 'File Location' ] % Code language: CSS ( css )

Save the flow and press Play. A message box appears with the config file value for the file location. Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?

If you have any questions or feedback about Simplify Flow Settings With A Config File In Power Automate Desktop please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Power Automate Desktop

Power Automate Desktop Config File Stored In Dataverse Table

Share this

Tagged

Power Automate

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nxtM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →