I am trying to access, in a project detail page, the project context via Javascript to retrieve the data of the custom fields.
But my problem is that, when I try to access all the data it only shows me three fields, and there are at least 20.
My code:
<script type="text/javascript">
var contexto;
var proyecto;
var fields;
function init() {
contexto = PS.ProjectContext.get_current();
proyecto = contexto.get_projects().getByGuid(PDP_projUid);
fields = proyecto.get_customFields();
contexto.load(fields);
contexto.executeQueryAsync(Function.createDelegate(this, this.Exito), Function.createDelegate(this, this.Error));
}
init();
function Exito() {
console.log('Exito');
console.log(fields);
console.log(fields.get_count());
for(i = 0; i < fields.get_count(); i++)
{
console.log(fields.get_item(i));
console.log(fields.get_item(i).get_name());
console.log(fields.get_item(i).get_description());
}
}
function Error() {
alert('Error');
}
</script>
All the fields, are controlled by the workflow, even the three that are successfully shown.
Any idea why this happens?
Aucun commentaire:
Enregistrer un commentaire