none
Unable to read Task customField value using JSOM

    Pertanyaan

  • Hi All,

    I'm trying to read Task level customfield value for a given project using JSOM. I can able to read the custom field's name and its internal name but getting undefined error while reading its value.

    Any help would be greatly appreciated.

    Below is the piece of code , is there anything wrong in the below code?

    projectContext.load(AllTasks, 'Include(Id, Name,CustomFields,IncludeCustomFields, FieldValues)');

    ====

    function  doWithTask(TaskInfo){  //for every individual task

     // alert('Task Name: ' + TaskInfo.get_name());     

    var fieldValues = TaskInfo.get_fieldValues();     

    var CFenumerator = TaskInfo.get_customFields().getEnumerator();         

    while (CFenumerator.moveNext()) {             

       var customField = CFenumerator.get_current();

       alert(customField.get_name() + " = " + fieldValues[customField.get_internalName()]);

      }

    }

    Thanks.


    Jumat, 26 Oktober 2018 06.13

Jawaban

  • Finally, I've sorted it out after spending so much time..

    Here, the task CF syntax is little different compare to the Project CF syntax. The below statement has given me the Task CF value.

    TaskInfo.get_fieldValues().Custom_9917ef727731e81180df00155d4cea0d.toString()



    Selasa, 30 Oktober 2018 10.53