greenawayr

Oldest SharePoint trick in the book

Blog Post created by greenawayr Champion on Aug 26, 2016

This is probably not news to many on here, but for those un-initiated in some of SharePoint quirks, I present the famous "Calculated Column" trick.

 

Do you want a really easy way to render a piece of HTML in a dataview on your SharePoint list or library?

 

Capture.PNG

Then here you go.

Create a Calculated column that looks a little something like this

Capture.PNG

 

Be sure to select anything OTHER THAN "Single line of text"

 

Your formula should look a little something like this

="<a href='www.google.co.uk'>Click Here to Approve</a>"

 

You can in fact use this for an number of other functions including Concatenates and IF's, for more details check out this link.

 

SharePoint will render this HTML as a clickable link for your users.

 

"What's the Nintex angle?" I hear you ask.

 

Well by creating a column called Approval URL or WorkflowMapURL and using the Nintex common properties to write to that column, you can then include that URL as your hyperlink, thus giving your users a link to the approval task straight from the item. Of course, only users who have had the task assigned to them can approve, but this is still a nice little trick. In fact you can use it for all sorts.

 

I created a Document library that contained 3 content types, Procedures, Forms and Deviations. The default view was set to Procedures, which would show all Procedures. Then as users began adding Forms and Deviations, they would be prompted for a piece of metadata called Proc Number, this was an identifier that linked a Procedure to a Form or a Deviation.

When an item was submitted, a workflow ran to identify whether a Procedure existed with that number, if it did it would build a URL of http://server/sites/sitename/libraryname/Forms.aspx?ProcNum=123456789

where the proc number is taken from item property. Write this to a column and then throw in an IF as well so that it only shows the hyperlink if a Form exists with the same Proc Number. It looks a little like this

 

=IF(
  ISBLANK
([FORMURL])
  
,""
  
,"<a href='SiteURL/Documents/Forms.aspx?ProcNum="
  
&[ProcNum]
  
&"'>Form(s)</a>"
  
)

 

I did the same with the Deviations and there it was, a library with Procedure documents and links to Forms and Deviations if they existed.

 

The power of the Calculated column

Capture.PNG

Outcomes