How to implement a ‘MailTo’ Link (html format) in a calculated Column in SharePoint List

For example, if you want to show an email link if the category (another column value say AppType) is ‘On-Request’, and by clicking on that you can open an outlook window to send a request email.
But you don’t want to show the full ‘href’ link instead just a text “Request” with an html link that will trigger the email. In that case you can use the following method.
Create a calculated column (say ‘Request’ for request email).
Add a content editor web part to the list page and add the following JavaScript.
if(typeof jQuery==”undefined”){
document.write(“”);
}
<SCRIPT type=text/javascript>
$(document).ready(function(){
$(“.ms-vb2:contains(‘

var tempDIV = document.createElement (“DIV”);
tempDIV.style.cursor = “pointer”;
tempDIV.innerHTML = $(this).text();
$(this).text(“”);
$(this).append(tempDIV);
});
});
Now give the following code as value for the calculated column you created:
=IF([App Type]=”On-Request”,”“,””)
Now you can see column values as html links.
The JavaScript function will convert the text to html wherever it finds the ‘DIV’ tag.

Leave a comment