Skip to content

Set multiple initial values in a list

Power Automate Desktop provides many actions for working with lists.

However, when you need to define a list and put several initial values in it, building the flow by combining “Create new list” and “Add item to list” makes the flow longer as the number of items grows.

This article explains how to set multiple items as the initial values of a list.

How to set multiple items as the initial values of a list

Section titled “How to set multiple items as the initial values of a list”

The action used here isn’t “Create new list” but “Set variable”.

The action has the following parameters.

Parameter Value
Variable The name of the variable to create
Value The value to store in the variable

In “Value”, you can enter not only text and numbers but also code directly.

By taking advantage of this and passing list data directly to “Value”, you can define a list with multiple initial values.

As a sample, here’s a flow that defines a list with three initial items.

Copy the following code and paste it into the Power Automate Desktop flow designer to add the action.

SET InitializedList TO ['itemA', 'itemB', 'itemC']
  1. In “Search actions”, type “Set variable”.

  2. Set the parameters as follows.

    Parameter Value
    Variable %InitializedList%
    Value %[‘itemA’, ‘itemB’, ‘itemC’]%
  3. When you run the flow, a list with multiple initial values is defined.