Power Automate endsWith() Function [How to Use]

Do you want to learn the Power Automate endsWith() function? Here, I will explain you, what is an endsWith() function in Power Automate.

I will also show how to write a syntax format for Power Automate endsWith() function. After that, I will explain examples of using the Power Automate endsWith() function.

The endswith() method returns a boolean value (true or false) indicating whether the specified string ends with the given substring.

Power Automate endsWith() Function

The Power Automate endsWith() function helps determine whether a string ends with a specified value. The outcome of the endsWith() function will always result in a boolean value, either true or false.

This function also considers spaces as characters. It is a case-sensitive function that checks if the string is an exact match.

This briefly introduces the endsWith() function in Power Automate.

Power Automate endsWith() function syntax

In this part, I will show the syntax of the endWith() function in Power Automate.

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

Input Parameters:

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

Return value:
Returns true if text ends with searchText.
Returns false if text does not end with searchText.

This is the syntax of the endWith() function within Power Automate.

How to use the endsWith() function in Power Automat

This section will provide examples of using the Power Automate endsWith() function in various scenarios.

Example 1:Power Automate endsWith() function using SharePoint list

You can see the image below.

To do this, I have taken a SharePoint list named “Customer Request” with a few columns and their datatypes.

Power Automate endsWith() function using SharePoint List

My requirement is to check whether a SharePoint list column [Request Description] ends with a specific value [High].

Let’s look at the following example.

TextSearch TextResult
It’s quite urgent, and I need assistance to resolve it as soon as possible. Please prioritize this request as High.HighTrue
It’s quite urgent, and I need assistance to resolve it as soon as possible. Please prioritize this request as High.LowFalse

How to use endsWith() function in Power Automate

To achieve this, follow the steps below.

1. Create an Automated cloud flow in Power Automate.

  • Navigate to https://make.powerautomate.com
  • Click on + Create
  • Select the Automated cloud flow
  • Choose trigger [When an item is created or modified]
  • Click on Create button

Provide all the required details inside the trigger Site Address, List Name as shown below.

Power Automate endsWith() function expression

2. Add the ‘Get item’ flow action to retrieve the properties of a specific item from a SharePoint list.

Set the required parameters:

  • Site Address: Provide the specific SharePoint site address.
  • List Name: Select the name of the SharePoint List.
  • Id: Provide the SharePoint item ID from dynamic content.
Power Automate endsWith() function format

3. To create and set the initial value of a variable, add the ‘Initialize variable’ flow action and set all the details.

  • Name: Enter the name for the variable.
  • Type: Select datatype as String.
  • Value: I have taken the SharePoint column ‘Requested Description’ from dynamic content.
How to use endsWith() function format in Power Automate

4. Next, add the ‘Compose’ flow action to check whether a given string ends with a certain string.

Add the below given expression in the inputs section.

endsWith(variables('endsWith'),'High')
endsWith() expression in Power Automate

After the flow is completed, save and test it manually.

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

How to use Power Automate endsWith() function expression

5. The compose flow action will display the output according to the endsWith() function expression below.

  • Output = true.
endsWith() function expression in Power Automate

Here’s how to use the Power Automate endsWith() function within a SharePoint list column.

Example 2:- Power Automate endsWith() function using Instant cloud flow

Now, I will show the below given example in a Power Automate Instant cloud flow.

TextSearch TextOutput
North AmericaAmericatrue
North AmericaAfricafalse
Microsoft Power Automate endsWith() expression

To work around this, follow the steps below.

1. Create an Instant cloud flow in Power Automate.

2. Next, add the ‘Initialize variable’ flow action to store the value of text during the flow.

Set all the required flow.

  • Name: Provide the name as ‘Country Name‘.
  • Type: Select the type of the variable as String.
  • Value: I have taken the string value ‘North America’ as the variable’s value.
How to use endsWith() function expression in Power Automate

3. Add the ‘Compose’ flow action and set the expression to extract the specified string ends with the given substring.

endsWith(variables('EndsCharacter'),'function')
Microsoft Power Automate endsWith function expression

4. Now, it’s time to Save and Test. Select the Manually radio button. Click Runflow.

5. The compose flow action will display the output as shown below.

endsWith() function format using Power Automate

This is how to use the endsWith() function in Power Automate.

Conclusion

I hope you find this Power Automate tutorial helpful.

This article covers:

  • Power Automate endsWith() function
  • endsWith() function syntax
  • Examples of using Power Automate endsWith() expression

Also, you may like some more Power Automate tutorials:

>