cancel
Showing results for 
Search instead for 
Did you mean: 

Power Automate - Constant Values - Avoid Initialize Variable actions

Problem:

In my flow, I have 10 constant values. I am using these constant values from many actions in the flow. To define each constant value in the flow, I used "Initialize Variable" action and stored the value. So for 10 constant values, I have created 10 "Initialize Variable" actions as shown below:

rsaikrishna_0-1598904701480.png

 

All the above "Initialize Variable" actions contains constant values ONLY.

 

Every time, when the flow executes, it send 10 API calls for these variable initialization.

 

Solution:

To improve the performance by reducing the number of API calls to initialize the constant values, you can use below method:

 

Step 1:  Use Compose method and create a JSON object with all constant values as below:

rsaikrishna_1-1598905096754.png

 

Step 2:  Use "Parse JSON" action to parse the output of above Compose action

rsaikrishna_2-1598905156080.png

 

Step 3:  Now, you can start using the constant values directly from other actions

rsaikrishna_3-1598905283823.png

 

Limitations:

The above approach will not work if you want to change the values of the constant.

 

Regards

Krishna Rachakonda

 

 

 

 

 

 

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Cambridge UK Power Platform User Group Leader, Technical evangelist and speaker. Always says yes to coffee! #LetsGetCoffee
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor
  • I am building business processes and applications that are easy for users' to stick to, so they can follow and understand them. In overall I transform processes to be more reliable and effortless. I am a proud co-organizer of SharePoint Saturday Warsaw and active community member, blogger and international speaker.