Text Functions Action in Power Automate within Dynamics 365

By | October 16, 2020

Introduction

Whenever we want to extract part of a string, a common question comes to mind -how do we achieve this? In Power Automate, previously we used to write some expression manually like split, substring and so on. But now, in the recent update of Power Automate, it now gives you prebuilt actions for text/string operations as shown in the below image.

At the time of writing this blog, there are only two actions available.

Find Text Position

As the name suggests, it helps in finding out the position of a text in a string.

Previously, if we wanted to find the particular text value from a string we had to write down the expression such as “indexOf(triggerBody()?[‘notes’], ‘title’)” in Power Automate to get the result.

But now with the help of Find Text Position action, the task of finding a text has been simplified.

The Find Text Position action will return the Text Position if the search text is present in the given string as shown in the below image.

Text Functions Action in Power Automate within Dynamic 365 CRM

Otherwise, it will return the Text Position as -1.

Text Functions Action in Power Automate within Dynamic 365 CRM

Similarly, we can use the Substring action to get the required string value from the text as explained below.

Substring

In this action, you can configure the starting index and length of the string and it will return the substring.

Previously, if we wanted to get the substring we had to write the expression like substring(triggerBody()?[topic],0,5) in which 0 is the starting position from where we want to start the substring function and 5 is the length of the string we want to extract from the starting position.

Now Substring Action eases this process.

In our below example screenshot, we want to extract the string value from the 0th to 5th index so we enter the start position as 0 and length as 5 since we want to extract the string till the 5th index of the string. We simply enter these values and based on them it will return the substring value.

Text Functions Action in Power Automate within Dynamic 365 CRM

Similarly, if Substring is out of the range, which means exceeding the length of the entire string, you will get an error as shown in the below image.

In our below example the entered string length was less than 5 characters, so the Substring action failed to extract it and gives the error as shown in the below image.

Text Functions Action in Power Automate within Dynamic 365 CRM

Conclusion

Now, with the addition of these actions, the idea of Low Code No Code has been taken a step further and we can expect more prebuilt actions in the coming future.