Power Automate startsWith() Function [With endsWith() Function]

As a Microsoft MVP in Power Automate skills, I had the opportunity to work with numerous flows that involved string manipulation functions. Today, in this tutorial, I will explain two very important functions: the startsWith() and endsWith() functions.

By the end of the tutorial, you will get to know how to use the startsWith() and endsWith() functions in Power Automate.

What is the startsWith() Function in Power Automate?

The startsWith() function in Power Automate is a text operation that checks if a string begins with a specific substring. It returns a boolean value (true or false) based on the result of this check, making it perfect for conditional branching in your flows.

This function is part of Power Automate’s extensive text functions library and follows this syntax:

startsWith(text, searchText)

Where:

  • text is the main string you want to check
  • searchText is the substring you’re looking for at the beginning of the main string

Return Value:

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

By default, the Power Automate startsWith() function is case-sensitive. This means “Hello” and “hello” are treated as different strings.

However, you can make case-insensitive comparisons by converting both strings to the same case:

startsWith(toLower(variables('MainText')), toLower('Hello'))

This expression will return true whether your variable contains “Hello,” “HELLO,” or “hello.”

Check out Add Multiple Users To SharePoint Group Using Power Automate

Power Automate startsWith() Example

To help you understand it better, I will take two examples here.

In one example, I will take some static text, and in the other examples, we will see how to use the startsWith() function in a SharePoint list item.

Example-1: Power Automate startsWith() function using Instant cloud flow

Let’s see how to use the startsWith() function in Power Automate by creating an Instant cloud flow that gets triggered manually.

Here, I have provided a text as: “Hello Lidia! Merry Christmas”. In the flow, we will check if it starts with “Hello”, then it will return true.

Here is a screenshot for your reference.

Power Automate startsWith() function

Follow the steps below to create the flow with the logic:

  1. 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 Create.
  1. Next, add the ‘Initialize variable‘ flow action. Configure parameters below:
    • Name: Enter the name for a variable.
    • Type: Select the type of the variable as String.
    • Value: Here, I have given ‘Hello Lidia! Merry Christmas’ as the variable’s value.
Power Automate startsWith() function expression
  1. Then, add the ‘Compose’ flow action to give the startsWith() expression like below:
startsWith(variables('StartingText'),'Hello')
How to use startsWith() function format in Power Automate
  1. Now, it’s time to save and test our flow. Here, test the flow manually, and once it is executed successfully, you can see the Compose Flow action that displays the output as shown below.
Power Automate startsWith() expression

This is how to use the startsWith() function in Power Automate to check whether a string begins with a specific value.

Check out How to Create SharePoint List Items Using Power Automate?

Now, let’s move to the second example.

Example-2: startsWith() function using SharePoint list in Power Automate

I will show you here how to use the startsWith() function using a SharePoint list in Power Automate.

Here I have a SharePoint Online list as “Blog List”; below are the columns and the data types.

ColumnsData Types
Blog Title(renamed Title column)Single line of text
Blog StatusChoice
Blog Publish DateDate and Time
Blog AuthorPerson and Groups

I have added a few items to the SharePoint list.

How to use startsWith() expression in Power Automate

In this case, we will create a flow that will check if the item title starts with “Power Automate,” then it will display true, else false. Below is a screenshot for your reference.

You can also apply your own logic; if anything specific you want to do if it returns true.

startsWith() function expression in Power Automate

Follow the steps below to create the flow and implement the logic.

  • Open the Power Automate home page, click + Create, then select Automated Cloud Flow. Enter the flow name and choose your trigger (e.g., When an item is created or modified), and finally click Create. Here, set the required fields for this trigger as shown below.
    • Site Address: Provide the specific SharePoint site address.
    • List Name: Select the name of the SharePoint list.
Power Automate startsWith() function using SharePoint list
  • To retrieve the value of a specific item from a SharePoint list, add the ‘Get item’ flow action. Configure the details like Site Address, List Name, and Id as shown in the screenshot below:
Power Automate startsWith() function format
  • To initialize the SharePoint list column, add an Initialize variable flow action and set all the details.
    • Name: Provide the name of the variable.
    • Type: Select the variable datatype as String.
    • Value: I have given ‘Title‘ from dynamic content here.
How to use startsWith() function expression in Power Automate
  • Next, add the ‘Compose‘ flow action to set the expression to check whether a given string starts with a specific string.
startsWith(variables('BlogStartsWith'),'Power Automate')
How to use startsWith() function in Power Automate
  • Now, it’s time to Save and Test -> Then test it manually. Now add an item to the SharePoint list as below:
Power Automate starsWith() function expression
  • The compose flow action will display the output according to the startsWith() expression below. The output returned from the Power Automate startsWith() function will give true.
Power Automate startsWith() expression using SharePoint List

This is how to use the startsWith() function in Power Automate for a column in a SharePoint list.

Check out Create Outlook Calendar Events Using Power Automate

Now, let us see how to use the endsWith() function in Power Automate.

Power Automate endsWith() Function

The endsWith() function in Power Automate is a text expression that checks if a string ends with a specific value. It returns a boolean value – TRUE if the string ends with the specified value, and FALSE if it doesn’t.

According to Microsoft’s official documentation, the function returns TRUE if a string ends with the given value, otherwise it returns FALSE.

Syntax and Basic Usage

The basic syntax of the endsWith() function is:

endsWith(text, suffix)

Where:

  • text: The main string you want to check
  • suffix: The ending text you’re looking for

For example, if you want to check if an email address ends with “.com”:

endsWith('[email protected]', '.com')

This expression would return true since the email address does end with “.com”.

Another use for the endsWith() function in Power Automate is to identify file types based on their extensions.

endsWith('quarterly_report.pdf', '.pdf')

This would return true, confirming that we’re working with a PDF file.

Check out How to Delete SharePoint Folders Using Power Automate?

Power Automate endsWith() Function Examples

Now, let me show you a few examples of using the endsWith() function in Power Automate.

Use Power Automate endsWith() Function Manually

To better understand the Power Automate endsWith() function, let us create a Power Automate flow that will trigger manually.

Here I have a string “Your Registration is Completed” and we will check if the string ends with “Completed”.

After using the Power Automate endsWith() function, the return output will be true, as shown in the screenshot below:

Power Automate endsWith() function syntax

To implement this example, follow the steps below:

  1. Open your browser and type https://make.powerautomate.com -> 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 -> Add a Text input inside the trigger.
  1. Then, add an Initialize variable flow action to store the text value. Set the properties like NameType, and Value as below:
    • Name: Provide a name for a variable.
    • Type: Select the data type as a String from the drop-down.
    • Value: Take Text from the dynamic content.
Power Automate endsWith() expression
  1. To see the output returned, add a Compose flow action and provide an endsWith() expression.

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

endsWith(variables('Text'),'Completed')
endsWith() function in Power Automate
  1. After that, Save the flow. Then, click on “Test” to run the flow manually. In the Runflow window, take a text input. After that, tap on the Runflow button. Here, I have given the input text as “Your Registration is Completed” as you can see below:
How to use Power Automate endsWith() Function
  1. After the flow runs successfully, open the compose flow action and check the output returned from endsWith() function expression. The Power Automate endsWith() function returned a ‘true‘ value.
How to use Power Automate endsWith() expression

This is how to use the Power Automate endsWith() function expression to determine a text ending with a specific string.

Check out Power Automate If Contains

Power Automate endsWith() Using SharePoint list

Now, I will walk you through the Power Automate endsWith() function using a SharePoint list.

To achieve this, I will create a Power Automate Automated cloud flow that triggers when an item is created in the SharePoint list.

You can see the SharePoint list having different columns in the screenshot below:

Column NameDatatype
Task TitleSingle line of text – Title column
Task Assigned toSingle line of text
Task DeadlineSingle line of text column

I have also added a few items to the SharePoint list.

endsWith() function expression in Power Automate

We will verify here if the item title ends with a specific substring “Project”.

To create the flow, follow the instructions below:

  1. Navigate to https://make.powerautomate.com/ -> click on +Create and select Automated cloud flow. In the next window, provide a name for the flow, choose the trigger “When an item is created,” and click on Create. Here are the details below:
    • Site Address: Select a site name from the drop-down.
    • List Name: Choose a list name from the drop-down
Microsoft Power Automate endsWith() function
  1. Next, add an “Initialize variable” flow action that stores the SharePoint column values and is used during the flow. Provide details below.
    • Name: Give a name for the variable.
    • Type: Select the datatype as String from the drop-down.
    • Value: Select the column name Title column from the dynamic content.
Power Automate endsWith() Expression
  1. Then, add a Compose flow action and set the details below.
    • Inputs: Take the below-given code value in it.
endsWith(variables('Task Name'),'Project')
Power Automate endsWith() Expression using SharePoint list
  1. Now, the flow is ready. Let’s Save it. Test it manually. Now, add an item to the SharePoint list.
  1. Then, the outputs of the compose flow action will indicate whether the created string ends with a specific string, returning true or false. In this case, it returned the true value.
How to use endsWith() function in Power Automate

This is how to use an endsWith() string function in a Power Automate based on a SharePoint list.

I hope you now understand how to use the startsWith() and the endsWith() functions in Power Automate. In Power Automate, the endsWith() checks the end of a string, startsWith() checks the beginning.

You may also like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…