Power Automate endsWith() Function

In this Power Automate tutorial, I will explain how to work with the endsWith() function in Power Automate, its syntax, and an example of how to use the Power Automate endsWith() function.

The “Power Automate endsWith() function” is used to determine if a text string ends with a specified sequence of characters. This function is particularly useful in Power Automate when you need to check the ending of strings within your flows, such as verifying file extensions, email domains, or certain patterns in data entries. It helps automate decisions based on the presence or absence of specific text at the end of a string, which can be critical for conditional logic in workflows.

Power Automate endsWith() Function

The Power Automate endsWith() function is a part of the set function that is the counterpart of the Power Automate startsWith() function. It determines whether a text input string ends with a specific value or a given string.

The output of the Power Automate endsWith() expression will always return the boolean values [true or false]. Spaces are also considered as a character.

Example:

I have taken a text input string value like [ Alex Wilber]. My requirement is to check whether the text input value ends with a particular text string [Wilber].

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

endsWith(‘Alex Wilber’), ‘Wilber’

After using the Power Automate endsWith() function, the output is returned as “true.”

Refer to the image below:

Power Automate endsWith() function

This is all about a brief introduction to the Power Automate endsWith() function.

Power Automate endsWith() Function Syntax

The below-given code will represent the Power Automate endsWith() function syntax format that can be used in a flow.

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

Input Parameters:

  • text: It is a required parameter for the string to be evaluated.
  • searchText: It is also a mandatory parameter that ends substring to find.

Return value:

  • true: Returns true when the ending substring is matched.
  • false: Returns false when the ending substring is not matched.

This is the syntax format for the Power Automate endsWith() function.

How to 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.

In this example, I assume the text input string value is [Your Registration is Completed]. My requirement is to check whether the string ends with a specific string [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 below-given steps:

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 Create button -> Add a Text input inside the trigger.

2. Then, add an Initialize variable flow action to store the text value. Set the properties like NameType, and Value like 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

3. 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

4. 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 Your Registration is Completed, as you can see below:

How to use Power Automate endsWith() Function

5. 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.

Power Automate endsWith() Using SharePoint list

I will walk you through the Power Automate endsWith() function using a SharePoint list in this section.

For this, I will create a Power Automate Automated cloud flow that will trigger when an item is created in the SharePoint list [Task 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
endsWith() function expression in Power Automate

Here, we wanted to verify whether the newly created items in a SharePoint list with the list column “Task Title” ending with a specific substring [Project].

Then, after using an endsWith() function, the output will be returned as true, as shown below:

endsWith() function format in Power Automate

Step-by-step, follow the below instructions:

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

2. 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 datatype as String from the drop-down.
  • Value: Select column name Title column from the dynamic content.
Power Automate endsWith() Expression

3. Then, add a Compose flow action and set the below details.

  • Inputs: Take the below given code value in it.
endsWith(variables('Task Name'),'Project')
Power Automate endsWith() Expression using SharePoint list

4. Now, the flow has been ready. Let’s Save it. Test it Manually. Now, add an item to the SharePoint list.

How to use endsWith() function in Power Automate

5. Then, the outputs of the compose flow action will give the result as true or false if the created string is found with an ending in a specific string.

  • In this case, it returned the true value.
Power Automate endsWith() function using SharePoint list

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

Conclusion

This Power Automate tutorial explains how to use the endsWith() function in Power Automate and its syntax.

I also covered a few examples of the Power Automate endsWith() function:

  • Example of Power Automate endsWith() function Manually
  • How to use endsWith() expression in Power Automate using a SharePoint list

Also, you may like some more Power Automate tutorials: