This flow tutorial will discuss how to initialize an object variable in Power Automate with an example.
Object Variable in Power Automate
In Power Automate, we can use different variable datatypes, one of which is the Object data type.
When we initialize a variable with an object data type, it accepts the values in JSON format. For example, JSON format consists of key and value pair parameters.
{"name":"John", "age":30}
Where,
- Key = name, age
- Values = John,30
In the following example, we will see how to initialize an object variable in Power Automate flow.
Example-1
- Recently, I got a requirement to send an email only to the selected users to notify the total sales and profit percentage values.
- We will achieve this by creating an object variable type and then dynamically passing the content values using Power Automate.
How to Initialize Object Variables in Power Automate
- Create an instant cloud flow -> Add the flow name (Power Automate initialize variable object) -> Select the Manually trigger a flow -> Click on the Create option.

- Expand the trigger action, select +Add an input, and then choose the Input type as Number.
- Enter the Input number field Name here. I have added two input number fields called Sales %Value and Profit % Value, as highlighted below:

- Then, we will add the action “Initialize variable“ action. Later, we will add the Variable name and choose the variable type as an Object.
- Add the dynamic content values for the added sales and profits in JSON format.
{
"Sales Percent Value": "38.34",
"Profit Percent Value": "60"
}

Now, we will add a compose action to check the output of the initialized variable object.

- To send an email, we will select the send an email action from the list of actions and then add the specific email address to the “To” section.
- Add the email “Subject“, here I have added the subject Sales and Profit Value as my email subject.
- In the Body section, we will add the message you want to send to the selected users.

- Then Test -> Save and run the Power Automate flow and select Run Flow automatically.
- Once the flow has run successfully, it notifies the mentioned recipient. In the output section, we can see the click-to-download option, it redirects to the output values.

- Then, we will receive the below email to the mentioned user with the message added in the send email action.

This is how to initialize a variable object in the Power Automate flow.
Example:2
Here, we will see how to initialize the variable object type in the Power Automate flow.
- Now, we will create a Power Automated flow with the trigger When an item is created or modified as below:

- Then, we will choose the action as Initialize variable action from the list of actions. Later, we will enter the Variable name (VarObject) and choose the Type as an Object.
- Add the dynamic content values from the SharePoint list in a JSON format as highlighted below:

- Select the +new step to add the compose action to see the output value from the initialized variable.

- Select the Flow checker, and fix if the error occurs. Otherwise, Save and Test the Power Automate flow.

- Here, we will select and modify the below highlighted SharePoint list item so that the Power Automate flow will trigger.

- The screenshot below shows that the compose action output section displays the data value as expected from the SharePoint list.

- In the same way, we will modify the different SharePoint list items as highlighted below:

- The Screenshot below displays the expected result value in the compose action output section.

This is another example of initializing the variable object type in the Power Automate flow.
This Power Automate tutorial shows how to initialize an object variable in Power Automate with different examples.
You may also like:
- Initialize String Variable in Power Automate
- Initialize Boolean Variable in Power Automate
- Initialize Array Variable in Power Automate
- Initialize Float Variable in Power Automate
Bijay Kumar Sahoo is a highly accomplished professional with over 15 years of experience in the field of SharePoint and related technologies. He has been recognized as a Microsoft MVP (Most Valuable Professional) more than 9 times, starting from April 2014, for his exceptional contributions to the SharePoint community. Bijay is also a prolific author, having written two books on SharePoint – “Microsoft Power Platform – A Deep Dive” and “SharePoint Online Modern Experience Practical Guide“. His deep insights into SharePoint are also shared on his popular YouTube channel EnjoySharePoint where he teaches SharePoint to a global audience (From various countries like the United States of America, Canada, the United Kingdom, Australia, New Zealand, etc). Read more…