dimanche 19 avril 2015

How to print only the created columns in Sharepoint using JavaScript

I need to print only the column that has been created by me.



function retrieveFieldsOfListView(listTitle,viewName){

var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle(listTitle);
var listFields = list.get_fields();
context.load(listFields);
context.executeQueryAsync(printFieldNames,onError);


function printFieldNames() {
var e = listFields.getEnumerator();
while (e.moveNext()) {
var fieldName = e.get_title();
console.log(fieldName);
}
}

function onError(sender,args)
{
console.log(args.get_message());
}

}


But this code is printing all the pre-defined fields along with my field. I don't want the pre-defined fields like 'modified,created,etc'. I want only the coding changes. UI changes are not upto me.


Aucun commentaire:

Enregistrer un commentaire