Site icon @WonderLaura

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.
  3. Be sure and leave the default type of text as Enhanced rich text.
  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.
  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.
  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.
  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.
  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.

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.

Exit mobile version