Power Automate StartsWith Function Explained

Power Automate StartsWith Function

The Power Automate StartsWith function checks whether a given string starts with a certain string or not.

Its counterpart is the endsWith function, that does the same for the ending of a string.

In this article, I’ll introduce you to the startsWith function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

Power Automate StartsWith Function

Power Automate StartsWith expression
startsWith function in Power Automate

Determine if a given string begins with a specified substring, ignoring case. Return true if the substring is present, or false if it is not.

Syntax

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

Input parameters

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

Return value

  • Returns true, if text starts with searchText.
  • Returns false, if text not starts with searchText.

Power Automate StartsWith Expression Example

startsWith('John Doe', 'John')
=> true

startsWith('John Doe', 'Doe')
=> false

How To Use The Power Automate StartsWith Function

Follow the steps to use the Power Automate startsWith function in a flow.

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

    Power Automate StartsWith new flow

    New flow

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

    Power Automate StartsWith new step

    Add a new step

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

    Power Automate StartsWith add init var

    Add Initialize variable action

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

    Power Automate StartsWith config var

    Setup variable

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

    Power Automate StartsWith add compose

    Add Compose action

  6. Setup compose action: 1) click into Inputs (popup appears), 2) click on ‘Expressions’, 3) set expression to ‘startsWith(variables(‘name’),’John’)’, 4) click on ‘OK’

    Power Automate StartsWith

    Setup startsWith expression in Power Automate

  7. Save and do a test run

    Power Automate StartsWith result test run

    Result test run – Power Automate StartsWith function example

Leave a Comment

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