Power Automate startsWith() Function [How to Use]

In this Power Automate guide, I will describe the Power Automate startsWith() Function. Then, I will show how to give the syntax format for the startsWith() function in Power Automate.

Afterward, I will demonstrate how to work with the Power Automate startsWith() function with various examples.

startsWith() function in Power Automate tests whether one text string begins with another substring string. It will return true; if the substring exists, else it will return false.

Power Automate startsWith() Function

Microsoft Power Automate startsWith() function is a set function. It will determine whether a provided string starts with a particular substring.

The output of the startsWith() expression will always return the boolean value, which is true or false. It is a case-insensitive function.

Example:

Assume a text string ”Hello and a warm welcome! Excited to have you with us.” I wanted to check whether the string begins with a specific substring [Welcome].

If the text input starts with that particular string, the output returned will be true, else the output returned will be false.

Here, the returned value is false. Refer to the image below.

startsWith() function syntax in Power Automate

This is the introduction to the Power Automate startsWith() function.

Power Automate startsWith() Function Syntax

You can see the syntax format for the Power Automate startsWith() function in the code below.

startsWith('<text>', '<searchText>')

Input Parameters:

  • text (mandatory): The string to be evaluated.
  • searchText (mandatory): The starting string to locate.

Return Value:

  • Returns true if text starts with search text.
  • Returns false if text does not start with search text.

This is how to give the Power Automate startsWith() function syntax.

How to use Power Automate startsWith() Function Manually

Let me show you a practical example of the Power Automate startsWith() function in an Instant cloud flow.

Example

I will consider a text input string value as ” Welcome aboard! Enjoy Your Trip.” My task is to check whether the text string starts with a specific substring [Welcome].

This can be verified by using the Power Automate startsWith() function. After using this function, the output returned will be true, as shown in the image below:

Power Automate startsWith() Expression

To check out this example, go through the steps below:

Here, let’s build a Power Automate Instant cloud flow that will trigger manually.

1. Browse https://make.powerautomate.com to open the Power Automate home page. Click on + Create -> Select the Instant cloud flow -> Provide the name of the flow and choose your trigger’s flow (Manually trigger the flow) -> Click on the Create button.

2. After that, take an Initialize variable flow action to store the value of a given string during the flow. Ensure to provide the details of the properties as below:

  • Name: Provide a name for the string variable.
  • Type: Select the datatype of a string from the drop-down as String.
  • Value: Take the value like “Welcome aboard! Enjoy Your Trip“.
How to use Power Automate startsWith() function expression

3. Next to it, add a Compose flow action to give the Power Automate startsWith() expression. In the Inputs of compose, take the expression.

Inputs: Select field -> Click Expression -> Insert the code -> Then click on OK.

startsWith(variables('Text'),'Welcome')

Then, click OK.

How to use Power Automate startsWith() function

4. When the flow is ready, Click Save and Run the flow. Select the Manually radio button in the Test flow window and click Test.

5. When the flow runs successfully, it will give the output in the boolean values as true or false. So, now open the compose action to check the outputs.

If the string starts with the search text value, then the return value will be true, else it will be false.

startsWith() Expression in Power Automate

This is how to use the Power Automate startsWith() function in a manual trigger flow.

Power Automate startsWith() Function using SharePoint list

Now, I will discuss another example of the Power Automate startsWith() function using a SharePoint list in an Automated cloud flow that will trigger when an item is created in the SharePoint list.

Example:

I have got a requirement from the client to check whether the SharePoint list column [Work Location with city] starts with a desired location or not [New York].

To meet this requirement, I have used a SharePoint list named ‘Hazarad Checklist – Workplace’ with column names and data types, as presented in the table below.

Column NameData type
Company NameIt is a single line of text – Title column
DateDate and time column
Work Location with citySingle line of text
startsWith() expression of Power Automate

After using the Power Automate startsWith() function, the output will be true or false, depending on the search text.

This is the result of the Power Automate startsWith() function.

Power Automate startsWith() Function using SharePoint list

Follow the below steps to implement the startsWith() function:

1. Open a Power Automate home page, click on +Create -> Select “Automated cloud flow” -> Provide flow name, choose a trigger ” When an item is created” -> Click on Create.

Set details below in a trigger.

  • Site Address: Select the site name from the drop-down.
  • List Name: Select the list name from the drop-down.
Power Automate startsWith() function format

2. In the same way, add an initialize variable to store the values of that column. Provide Name, Type, and Value parameters.

  • Value: Select value as a column name ‘Work Location with city‘ from the dynamic content.
How to use startsWith() function expression

3. Similarly, add a Compose flow action and set the input value as provided in the code below.

Inputs: Click Expression -> Insert the code -> Select OK.

startsWith(variables('City'),'New York')
power automate startswith function

4. Once the flow has been ready. Click on Save and Test it Manually.

5. Now add an item to the SharePoint list, as shown in the screenshot below:

startsWith() function format in Power Automate

6. The compose flow action outputs will return the boolean values like true or false, as shown below.

  • If the created item satisfies the expression -> Output as true.
Microsoft Power Automate startsWith() function

Using a SharePoint list, this is how to use the startsWith() function in a Power Automate.

Conclusion

I hope you understand the startsWith() function in Power Automate from this tutorial. I have also covered the below Power Automate startsWith() examples.

  • Power Automate startsWith() expression in an Instant cloud flow.
  • Example on startsWith() expression in Power Automate using a SharePoint list.

Moreover, you may like some more Power Automate tutorials: