Power Automate EndsWith Function Explained

Power Automate EndsWith Function

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
endsWith function in Power Automate

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.

  1. Create a new flow with trigger ‘Manually trigger a flow’

    power automate endswith new flow

    New flow

  2. Add a new step by clicking on ‘+ New step’

    power automate endswith new step

    Add a new step

  3. Search for ‘initialize’ and click on ‘Initialize variable’

    power automate endswith initialize variable step

    Add Initialize variable action

  4. Setup Initialize variable: 1) Provide a name, 2) select type String, 3) Set value to ‘John Doe’

    power automate endswith setup initialize variable

    Setup variable

  5. Add a compose step by searching for ‘compose’ and clicking on ‘Compose’

    power automate endswith compose

    Add Compose action

  6. 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’

    power automate endswith setup compose

    Setup endsWith expression in Power Automate

  7. Save and do a test run

    power automate endswith test run

    Result test run – Power Automate EndsWith function example

Leave a Comment

Your email address will not be published. Required fields are marked *