Custom Hyperlink Icon Column

Have you ever wanted to have a nice pretty button, right on the row of one of your list or library items in SharePoint, and that button does something custom?

Out of box, there’s a column called “Edit”, and you can add that to your view, and it gives you a quick way to get to the edit page with just one click.  Also, there’s a way to create a hyperlink column, which is useful for having a custom link.  AND, there’s a way to create a custom action in SharePoint Designer, which puts a button in the ribbon or in the list item drop-down menu.  All of those are options available out-of-box.  Also, back when data view web parts and editing views in SharePoint Designer was possible (in 2007/2010), I used to directly edit views visually, and create pretty little buttons all the time, that I would put in rows and make them dynamic, such as a button to take you to some special dashboard or filtered view.  In the current versions of SharePoint, it’s just not as straightforward.  Now, there’s no way I’m the first person to think of this, but I’ve just discovered a very easy way to create a pretty, custom hyperlink button that shows on your list items and on each row.  There are MANY uses.

How is it done?

  1. Go to the list where you’d like this new column to show, and go to List Settings.
  2. Create your column, whatever you want it to be called.  I called mine “Dashboard”.  The trick here, is that you’re going to choose Multiple lines of text as the type of column.
    image
  3. Be sure and leave the default type of text as Enhanced rich text.
    image
  4. Now that your site column exists, go ahead and add it to the list or library where you want to use it.  My list is called Travelers.  Go to list/library settings, scroll down and click Add from existing site columns.
  5. Pick your new column you just created, like “Dashboard”, add it, and click OK.The next step is going to be to create a workflow.  The workflow will create the hyperlink and place the hyperlinked image in this new column when a new item is created.   There are many different types of scenarios, but in this example, I have another page in my site that I’m using as a dashboard, and I want the link to take users to the dashboard for that specific traveler.  So the link will pass a query string parameter to the web part page, which will send filter information to web parts on that page.
  6. I also created a little graphic, Dashboard.png, and uploaded it to my site’s Site Assets library. Dashboard
  7. Open your site in SharePoint Designer.  Create a new workflow. In this case I’ll call mine “New Traveler” and set it to run when new items are created.
  8. Add the action called Set Field in current Item.
    image
  9. Click field, and pick the name of the Dashboard column you just created.
  10. Click value, and then click the ellipsis button, which brings up the String Builder screen.
    image
  11. This HTML code will be used to display a hyperlink button.  Think about it, though, you could put a table in here, and even multiple images and buttons.  Whatever HTML you want.  This is the code in this example:<p><a href=”#SitePages/Dashboard.aspx?Traveler=#”>
    <img src=”#SiteAssets/Dashboard.png” alt=”” style=”margin: 5px; width: 16px;”/></a></p>
  12. Copy the HTML code in gray above, and paste it into the String Builder. Each place that you see a # pound sign, those are going to be replaced with fields, by clicking the Add or Change Lookup button.
    image
  13. Click OK, that’s the only action we need in the workflow.  The ID of the current list item will be used as the query string parameter, to pass to our dashboard.aspx page that doesn’t exist yet.  Publish the workflow.
  14. Go to your site pages library, and create a new web part page.  Name it Dashboard.  If you’re wondering about this whole Query string thing, I’ve written several other posts about them.  I also taught a SharePoint Power Hour about them.  Hint: You can add the query string url filter web part to the dashboard page, and then add travelers and other related lists you may have, and connect them all with web part connections. Winking smile

Create a list item in your list, and the workflow should automatically run, and show your image as a hyperlink in that new column of your list.  That’s it!

Updated 7/14/2017:  In a document library, you can’t create an enhanced rich text field.  So, the pretty icon won’t be possible.  In a site that is an Office 365 group, you can’t create custom actions, so the pretty button won’t be possible.  But you can create it as just a hyperlink field instead.  So, at steps 2 & 3 when you create your column, create it as a hyperlink.  Then, follow my other blog here, showing how to create a hyperlink via workflow. At steps 8 & 9 above, that’s where you’ll select the hyperlink column. Then, go to step 10 in the other blog post, and that’s where you’ll use your #SitePages/Dashboard.aspx?Traveler=# and fill in the current site url and the current item ID in the # spots.  For the part after the comma over in step 14 in the other post, you could just type Dashboard.

Now, think of the possibilities!  In Office 365 right now, with the new look of the lists, it’s at least two clicks to get to the edit form of any item, and the good old “Edit” column doesn’t work anymore.  I’ve already used my new solution to create a custom “Edit” button on a library, for users to know how to quickly edit the properties.

19 comments

  • Thank you! I have got to try this. I have a number of projects I can use this for!! Awesome!

  • Hi Laura, thanks for the post. Before modern lists, I used to have a calculated column with the same html tags that used to worked just fine. Now with them (modern lists), it just shows the html code, and doesn’t display the link. As I have more than 4000 items in the list, I guess your workflow isn’t an option. Do you know a workaround with existing items? Any help would be appreciated.

  • Ricardo, try setting the column to Number (and adding some text to display if needed).

    I’m sorry I don’t have access to 2016 or O365, so…with that in mind…

    In SP 2013 on prem, I use a calculated column that is set to Number. That is vital, you have to set the data type returned to Number. I have a list of sites with links to all the admin pages, like permissions, permissions setup, contents, etc. The formula used for the permissions link column is:
    =”Permissions

    [Site URL] contains values such as /org/ad/Team-BT/ so the resulting url is the same as going to Site Settings and clicking on Site permissions.
    You can put any text you want to replace ‘Permissions’ so it displays what you want.
    If you want to use an image, replace the text with an img tag
    =”

  • I love reading your blog because it has very interesting topics.~`*.;

  • does this work in the modern UI?

  • Shruti Kulkarni

    I tried this solution to link to my new Edit form in the custom list, however when i try to edit the item using the default edit form, it creates a new line item instead of appending on the same item. Let me know if there is a solution for this. Thank you!!

  • Ricardo, I agree with Tim. I use this method through out my site and it does work. I know it’s counterintuitive but it really does work.

  • Is it still working ? Because I have tried it in a list and after workflow copy in the rich text field .. the href was removed.
    Any idea?

  • Is there a way to create a button on a list created in SharePoint Online that would point to a PowerApps request form that I created? My IT team wants me to have a button labeled, “Create IT Requests” at the top of the List that contains all the details of previously created reqeusts. I tried to create a subsite, page and team site. I can create the buttons on each of these examples. Hoever, they do not allow me to display the full list and only a preivew of it that cuts off the information to the rest of the columns. I appreciate your help in this matter.

  • On 365 it is now possible to set JSON formatting on columns (https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting) which can be used to create a little hyperlinked icon and a lot of other stuff. I have had a little play about with this and it took me less than 1/2 an hour to get an Red/Amber/Green icon showing based on the cell value. Unfortunately this currently only works on the list views, not a list webpart yet!

  • Pingback: Email Hyperlink to Form | @WonderLaura

Leave a Reply