I created a new sharepoint content type with created custom columns, then created a new task list. I made my content type as default. If I try to get the value of my created columns (text) I get an undefined (of course I use the internal name of the column).
Do I get only the value of default sharepoint columns? Or am I missing something?
(function (){
//init
var inCtx = {};
var mfield = {};
inCtx.Templates = {};
inCtx.Templates.Item = ItemOverride;
inCtx.Templates.Header = "<div>";
inCtx.Templates.Footer = "</div>";
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(inCtx);
function ItemOverride(itemCtx){
var result = "";
result += "<h4>";
result += itemCtx.CurrentItem.Title + " ";
result += itemCtx.CurrentItem["MYCOLUMN"];
result += "</h4>";
return result;
}
})();
I added console.log(itemCtx.CurrentItem) to my function:
AssignedTo:Array[1]
Checkmark:"Nein"
ContentType:"MY CONTENT TYPE"
ContentTypeId:"0x010800B190D14F1764B34B90CEC6190DEBEA2D00CAA91C9504256348A9CD224C2E078360"
Created_x0020_Date.ifnew:"1"
DueDate:"19.08.2016"
DueDate.FriendlyDisplay:"1|1|7|Freitag"
FSObjType:"0"
FileLeafRef:"1_.000"
FileRef:"/sites/mr_demo/Lists/Zieleliste/1_.000"
File_x0020_Type:""
File_x0020_Type.mapapp:""
HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon:""
HTML_x0020_File_x0020_Type.File_x0020_Type.mapico:"icgen.gif"
ID:"1"
PercentComplete:"0 %"
PercentComplete.:"0"
PermMask:"0x7fffffffffffffff"
Title:"Task 1"
firstRow:true
outlineLevel:"1"
__proto__:Object
console.log(itemCtx)
inside the function and see what you get in the F12 console