Flow: clean up string for URL

One of the reasons I do this blog is so that I can find all the nice tips, tricks and scripts again after I’ve used them. As such, I end up re-blogging what some other kind souls have already done, this is one of those.

Scenario: You have a string that you want to use as part of a URL in Microsoft Flow

Issue: It’s a free text box, and users can add in spaces and special characters.

Solution: Create a variable and set it to the following expression:

Replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(triggerBody()?['Title'],':',''),'%',''),'#',''),'*',''),'<',''),'>',''),'?',''),'/',''),'"',''),'"',''),'@',''),'&',''),'=',''),'/',''),';',''),'|',''),'\',''),'[',''),']',''),'~',''),'{',''),'}',''),'^',''),'!',''),',',''),'.',''),' ','')

NOTE: this will take the Title field of the triggering item and remove the special characters and spaces.

Originally found at this blog post: https://blog.mydock365.com/easy-way-to-convert-string-to-a-url-friendly-string-using-microsoft-flow

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s