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
- Compose
- Parse JSON
For example, if you want to hardcode the Site URL and some of the list Names we can do something like this...
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
Just curious - is there some benefit of using the compose action, over putting the JSON directly into the Content field for the Parse JSON action?
ReplyDeleteHi, there is not much benefit of it.. you can skip.. it is added for explanation and simplification of the flow. By adding that others can understand what JSON is expected
Delete