Easy Way to Convert String to a URL Friendly String Using Microsoft Flow

Usually, when you convert the URLs from external sources, it comes with special characters . Let’s see how to convert String to a URL friendly string.

Well, this requirement came up for one of our Client that is a Marketing Agency based in Jacksonville, FL. They have a SharePoint list to save external URLs that is used by their team across the United States. Usually, when you convert the URLs from external sources, it comes with special characters like !@$#>% and couple of others. That’s when we found a way to convert such strings into a URL friendly string with the help of Microsoft Flow. Let’s see how this works:

Microsoft_Flow_Home_Screen

You can rely on the Replace function available in Microsoft Flow. This helps you to replace character by another one. In this scenario, we need to replace the special characters with a blank space. When this is done for each character at a time, you can nest them and you will get all the information in a single function.

Let’s create a Title dynamic property with the trigger of characters: [ ] ~ { } ^ ! , . % # * < > ? / ” @ & = / ; |) \

Copy the below code:

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'],':',''),'%',''),'#',''),'*',''),'<',''),'>',''),'?',''),'/',''),'"',''),'"',''),'@',''),'&',''),'=',''),'/',''),';',''),'|',''),'\',''),'[',''),']',''),'~',''),'{',''),'}',''),'^',''),'!',''),',',''),'.',''

As you see below, a quick Flow can be setup for you to see the results. A 3-easy step procedure and we can get this done in minutes!

  1. When item is created
  2. Initialize Variable
  3. Update Item

Now create a Variable with Friendly URL and update item:

MS_Flow_Workflow_Screenshot

The variable values are the formula we had mentioned earlier, so make sure to update it with the actual string which you need it to be fixed. Copy pasting this will fix Title property of the trigger.

MS_Flow_Workflow_Screenshot_2

The output:

SharePoint_Office365_Group

The previous step didn’t actually help us remove the spaces. So, let’s try another code to remove the spaces too:

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'],':',''),'%',''),'#',''),'*',''),'<',''),'>',''),'?',''),'/',''),'"',''),'"',''),'@',''),'&',''),'=',''),'/',''),';',''),'|',''),'\',''),'[',''),']',''),'~',''),'{',''),'}',''),'^',''),'!',''),',',''),'.',''),' ','')

Here's the output for the above query:

SharePoint_Office365_Group

Make sense? Awesome isn’t it? Give it a try and let us know your experience with Microsoft Flow and SharePoint!

Table of contents

Read more blogs

See all

Contract Management Strategy

9 CLM Customization Pitfalls to Avoid in Implementation

Learn how businesses can improve adoption, integration, compliance, scalability, and ROI with the right Contract Lifecycle Management strategy.

Read more

Compliance & Risk Management

Why Companies Need Safety and Risk Management Software

Safety management system allows to monitor employee safety. Ensure all your safety & health management strategies are intact with Safety management system.

Read more

SharePoint & Microsoft 365 (Product Tips & How-Tos)

All That You Should Know About SharePoint Modern Pages – Part 4

In the fourth part of our blog series on SharePoint Modern pages, we will show you how to add sections and columns to SharePoint pages. Read the blog now!

Read more

Less time on contracts, complete control over them.

Automate contract tracking and renewals, connect every agreement to its vendors, invoices, and projects, and get full visibility with enterprise-grade security built in.

Our contract process didn't fit neatly into the rigid workflows offered by many vendors.

Dock 365 was the last vendor I looked at, but it quickly became clear it was the right fit

Jennifer McGaffey

Legal Operations Manager, Short Elliott Hendrickson