The Power Automate endsWith function checks whether a given string ends with a certain string or not.
Its counterpart is the startsWith function, that does the same for the ending of a string.
In this article, I’ll introduce you to the endsWith function and will provide a step-by-step guide on how to use the function in a Microsoft flow.
Power Automate EndsWith Function
Power Automate EndsWith Function

Determine if a given string ends with a specified substring, ignoring case. Return true if the substring is present, or false if it is not.
Syntax
endsWith('<text>', '<searchText>')
Input parameters
- text (mandatory): The string to be evaluated.
- searchText (mandatory): The ending string to locate.
Return value
- Returns true, if text ends with searchText.
- Returns false, if text not ends with searchText.
Power Automate EndsWith Expression Example
endsWith('John Doe', 'Doe')
=> true
endsWith('John Doe', 'John')
=> false
How To Use The Power Automate StartsWith Function
Follow the steps to use the Power Automate endsWith function in a flow.
-
Create a new flow with trigger ‘Manually trigger a flow’
New flow
-
Add a new step by clicking on ‘+ New step’
Add a new step
-
Search for ‘initialize’ and click on ‘Initialize variable’
Add Initialize variable action
-
Setup Initialize variable: 1) Provide a name, 2) select type String, 3) Set value to ‘John Doe’
Setup variable
-
Add a compose step by searching for ‘compose’ and clicking on ‘Compose’
Add Compose action
-
Setup compose action: 1) click into Inputs (popup appears), 2) click on ‘Expressions’, 3) set expression to ‘endsWith(variables(‘name’),’Doe’)’, 4) click on ‘OK’
Setup endsWith expression in Power Automate
-
Save and do a test run
Result test run – Power Automate EndsWith function example