Power Automate Tip: How to define constants without having too many variabled declared

 



I have been architecting things and came to my observation that developers are using too many of the variables in the flow which they want to keep the hard-coded values or technically say constants. Declaring/initializing too many variables makes the flow very big and becomes hard to understand. Moreover, it takes a lot of time and effort to add the number of variable components and to name and add comments. This tip will save you from all of these.


So for a quick tip on how we can declare the constants more effectively so that we are not filling the whole screen with the variable declaration

So to do it we can make use of 2 connectors

  1. Compose
  2. Parse JSON

For example, if you want to hardcode the Site URL and some of the list Names we can do something like this...

Step 1: Compose




Step 2: Parse JSON




Step 3: Usage




Conclusion


So these 2 steps will save a lot of your time and effort which you spent in adding the variable connector and defining them. If you want to update any property at any point in time you can also do that using the expression.


Happy Coding..!!
Sumit Kanchan

Comments

Popular posts from this blog

Rename Folder using Microsoft Flow / Power Automate in a Document Library in SharePoint Online

How to check for empty for null and empty Values in Power Automate?

SharePoint Framework (SPFx) Tab Control (react)