Archive for March, 2015

SharePoint 2013: Getting lookup column values in JSLink

Hi Friends,

While working on of the development requirement related to JSLink I came across a scenario where a lookup value needed to be shown in a list view web part.

I wanted to demonstrate with following code how we can achieve to show the lookup values form single valued or multi valued lookup.

Before that I would like to show the relationship between the lists I used to show the demonstration.

I have created following two custom lists for demonstration.

First list with following column –



The content in First list will like something –


Second list having lookup column from first list –



The content in second list like following –


Following code will show how to get the single or multi valued lookup values and show.

(function () {

var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Item = CustomPortalPageItem;
function CustomPortalPageItem(ctx) {
var html = "";
html += '<div title="' + ctx.CurrentItem.Title + '"></div><div>'+GetLookupValues(ctx.CurrentItem.Test11,"lookupValue")+'</div>';
return html;

function GetLookupValues(inputArry,originalColumnName)
var retHtml="";
for(var loopcnt=0;loopcnt<inputArry.length;loopcnt++)
if (typeof(inputArry[loopcnt][originalColumnName]) != 'undefined' && inputArry[loopcnt][originalColumnName] != null)
return retHtml;

After this it will look like following,you can then apply beautiful HTML to it.