In this Power Automate guide, I will describe the Power Automate startsWith() Function. Then, I will show how to give the syntax format for the startsWith() function in Power Automate.
Afterward, I will demonstrate how to work with the Power Automate startsWith() and Power Automate endsWith() functions with examples.
Table of Contents
Power Automate startsWith() Function
Power Automate startsWith() function is a set function. It will determine whether a provided string starts with a particular substring.
The output of the startsWith() expression will always return the boolean value, which is true or false. It is a case-insensitive function.
Example:
Assume a text string ”Hello and a warm welcome! Excited to have you with us.”I wanted to check whether the string begins with a specific substring [Welcome].
If the text input starts with that particular string, the output returned will betrue, else the output returned will befalse.
Here, the returned value is false. Refer to the image below.
This is the introduction to the Power Automate startsWith() function.
Power Automate startsWith() Function Syntax
You can see the syntax format for the Power Automate startsWith() function in the code below.
startsWith('<text>', '<searchText>')
Input Parameters:
- text (mandatory):The string to be evaluated.
- searchText (mandatory):The starting string to locate.
Return Value:
- Returnstrueif text starts with search text.
- Returnsfalseif text does not start with search text.
This is how to give the Power Automate startsWith() function syntax.
How to use Power Automate startsWith() Function Manually
Let me show you a practical example of the Power Automate startsWith() function in an Instant cloud flow.
Example
I will consider a text input string value as ” Welcome aboard! Enjoy Your Trip.” My task is to check whether the text string starts with a specific substring [Welcome].
This can be verified by using the Power Automate startsWith() function. After using this function, the output returned will be true, as shown in the image below:
To check out this example, go through the steps below:
Here, let’s build a Power Automate Instant cloud flow that will trigger manually.
1. Browse https://make.powerautomate.comto open the Power Automate home page. Click on+ Create-> Select theInstant cloud flow-> Provide the name of the flow and choose your trigger’s flow(Manually trigger the flow)-> Click onthe Create button.
2. After that, take an Initialize variable flow action to store the value of a given string during the flow. Ensure to provide the details of the properties as below:
- Name: Provide a name for the string variable.
- Type: Select the datatype of a string from the drop-down as String.
- Value: Take the value like “Welcome aboard! Enjoy Your Trip“.
3. Next to it, add a Compose flow action to give the Power Automate startsWith() expression. In the Inputs of compose, take the expression.
Inputs: Select field -> ClickExpression-> Insert thecode-> Then click onOK.
startsWith(variables('Text'),'Welcome')
Then, click OK.
4. When the flow is ready, Click Save and Run the flow. Select the Manually radio button in the Test flow window and click Test.
5. When the flow runs successfully, it will give the output in the boolean values as true or false. So, now open the compose action to check the outputs.
If the string starts with the search text value, then the return value will be true, else it will be false.
This is how to use the Power Automate startsWith() function in a manual trigger flow.
Power Automate startsWith() Function using SharePoint list
Now, I will discuss another example of thePower Automate startsWith() functionusing a SharePoint list in an Automated cloud flow that will trigger when an item is created in the SharePoint list.
Example:
I have got a requirement from the client to check whether the SharePoint list column [Work Location with city] starts with a desired location or not [New York].
To meet this requirement, I have used a SharePoint list named ‘Hazarad Checklist – Workplace’ with column names and data types, as presented in the table below.
Column Name | Data type |
Company Name | It is a single line of text – Title column |
Date | Date and time column |
Work Location with city | Single line of text |
After using the Power Automate startsWith() function, the output will be true or false, depending on the search text.
This is the result of the Power Automate startsWith() function.
Follow the below steps to implement the startsWith() function:
1.Open a Power Automate home page, click on +Create -> Select “Automated cloud flow” -> Provide flow name, choose a trigger ” When an item is created” -> Click onCreate.
Set details below in a trigger.
- Site Address:Select the site name from the drop-down.
- List Name:Select the list name from the drop-down.
2.In the same way,add an initialize variableto store the values of that column. Provide Name, Type, and Value parameters.
- Value:Select value as a column name ‘Work Location with city‘ from the dynamic content.
3.Similarly, add a Compose flow action and set the input value as provided in the code below.
Inputs: Click Expression -> Insert the code -> Select OK.
startsWith(variables('City'),'New York')
4.Once the flow has been ready. Click onSaveandTestit Manually.
5.Now add an item to the SharePoint list, as shown in the screenshot below:
6. The compose flow action outputs will return the boolean values like true or false, as shown below.
- If the created item satisfies the expression -> Output as true.
Using a SharePoint list, this is how to use the startsWith() function in a Power Automate.
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 betrue, else the output returned will befalse.
endsWith(‘Alex Wilber’), ‘Wilber’
After using the Power Automate endsWith() function, the output is returned as“true.”
Refer to the image below:
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:
To implement this example, follow the below-given steps:
1. Open your browser and type https://make.powerautomate.com -> Click on+ Create-> Select theInstant cloud flow-> Provide the name of the flow and choose your trigger’s flow(Manually trigger the flow)-> Click onCreate button -> Add a Text input inside the trigger.
2. Then, add an Initialize variable flow action to store the text value. Set the properties likeName,Type, andValue 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.
3. To see the output returned, add a Compose flow action and provide an endsWith() expression.
Inputs: Select field -> ClickExpression-> Insert thecode-> Then click onOK.
endsWith(variables('Text'),'Completed')
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:
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.
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 Name | Datatype |
Task Title | Single line of text – Title column |
Task Assigned to | Single line of text |
Task Deadline | Single line of text column |
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:
Step-by-step, follow the below instructions:
1.Navigate to https://make.powerautomate.com/ -> click on+Createand select Automated cloud flow. In the next window, provide a name for the flow, choose the trigger “When an item is created,” and click onCreate.
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
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.
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')
4.Now, the flow has been ready. Let’sSaveit.Testit Manually. Now, add an item to the SharePoint list.
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.
This is how to use an endsWith() string function in a Power Automate based on a SharePoint list.
Conclusion
I hope you understand the startsWith() function in Power Automate from this tutorial. I have also covered the Power Automate startsWith() examples below.
- Power Automate startsWith() expression in an Instant cloud flow.
- Example on startsWith() expression in Power Automate using a SharePoint list.
- Power Automate endsWith() function with examples.
Moreover, you may like some more Power Automate tutorials:
- Power Automate Odata Filter Query Startswith
- Power Automate get SharePoint list items count
- Power Automate isInt() Function
- Power Automate Contains() Function
- Power Automate toLower() Function
Preeti Sahu
Preeti Sahu is an expert in Power Apps and has over six years of experience working with SharePoint Online and the Power Platform. She is the co-author of Microsoft Power Platform: A Deep Dive book. As a Power Platform developer, she has worked on developing various tools using Power Apps and Power Automate. She also makes Microsoft 365 videos and shares them on YouTube.