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?
- Go to the list where you’d like this new column to show, and go to List Settings.
- 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.
- Be sure and leave the default type of text as Enhanced rich text.
- 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.
- 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.
- I also created a little graphic, Dashboard.png, and uploaded it to my site’s Site Assets library.
- 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.
- Add the action called Set Field in current Item.
- Click field, and pick the name of the Dashboard column you just created.
- Click value, and then click the ellipsis button, which brings up the String Builder screen.
- 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>
- 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.
- 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.
- 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!
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.