Display Username in CSL
Posted: 28 Nov 2016
i need to display the user display name in csl field via an "Assigned To" column, but curruntly displaying "undifined", here my code and screen shot:
Request items:
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Title,ActivationDate&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Title,ActivationDate&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
Item format:
function(item) {
return '<div style="height: 50px; clear: both;"><div style="width: 45px; float: left;"></div><span>' + item["Title"] + "<br>" + item["{LookupField}"] + "<br>" + item["ActivationDate"] + '</span></div>';
}
Request items:
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Title,ActivationDate&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Title,ActivationDate&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
Item format:
function(item) {
return '<div style="height: 50px; clear: both;"><div style="width: 45px; float: left;"></div><span>' + item["Title"] + "<br>" + item["{LookupField}"] + "<br>" + item["ActivationDate"] + '</span></div>';
}