Sanitizing with Microsoft Flow

Reading Time: 2 minutes

Probably this is the first article where I decided to focus my attention on Microsoft Flow.
I see this powerful service like your personal developer because you can achieve an amazing result without any line of code.
Naturally, it doesn’t cover all business scenarios, but I love to use it when is possible.
I love especially how can simplify things from a developer perspective.
Lately, I’ve been working on a project where one requirement, was to clean a parameter defined by the user as input from some special characters.
So with some simple Flow steps, you can easily achieve this goal.

Solution

Now assuming that I have to remove some special characters from a string, let’s start to build our Flow.
I’m gonna to create a Flow that will be triggered by a button just for this purpose and it will accept an input from the user “Title”:

Sanitizing with Microsoft Flow | Giuliano De Luca

Considering that in Flow the self-reference is not supported, then a variable cannot assign a value to herself, I need to use an extra variable.
Below how looks like the initialization block:

Sanitizing with Microsoft Flow | Giuliano De Luca

In the function createArray(…), I’ll insert the characters that I want to remove:

Sanitizing with Microsoft Flow | Giuliano De Luca
createArray(‘@’,’ß’,’²’,’³’,’µ’,’`’,’´’,’°’,’^’,’=’,'(‘,’)’,’&’,’$’,’§’, ‘~’,’#’,’%’,’*’,’:’,'<‘,’>’,’?’,’/’,’|’,’ ‘)

In the next step I’ll iterate the array by replacing every character that I find:

Sanitizing with Microsoft Flow | Giuliano De Luca

Below the replace function:

Sanitizing with Microsoft Flow | Giuliano De Luca
replace(variables(‘Sanitize’), item(), ”)

Finally this is the result;

Sanitizing with Microsoft Flow | Giuliano De Luca