I love regex: Replace URL with Link in Html table output of workflow action

Posted by

Thanks to Aiden Kaskela’s Workflow Elements we can use this great custom workflow action Query – Get Results to get results formatted as an HTML table to insert in an email.

But I would like to include a link to the record in the Html table but it’s not possible to configure the workflow action for that purpose. So I came up with the following solution.
When a record is created I use a workflow to update a custom field with it’s URL.

Then this Record URL field is included as first column in the Html table output but I want to change it into a link. Well nothing is impossible if you call in the help of regular expression !

So the URL of a record is like this:

And by using the regular expression pattern: (?=https).*?(?>entityrecord)
with replacement by: <a href=’$&’>Open</a>
you get the following result:

That’s all. I love regex !

Leave a Reply

Your email address will not be published. Required fields are marked *