Utilizing REST/JS calls to populate specific fields from a particular list item has presented some challenges for me. The issue arises when attempting to retrieve certain fields, as they are showing up as undefined in the displayed results. Upon examination, it seems that the problematic fields fall under types such as Lookup, Person or Group, and Choice. Conversely, fields of type Single line of text, Date and Time, and Number are displaying correctly. Despite extensive research through various articles, I have yet to find a solution. Below is an excerpt of the code snippet in question:
$(function() {
$.ajax({
url: "__URL__/_api/lists/getbytitle('Master%20Project%20List')/items?&$filter=Number eq '" + projectId + "'",
headers: {"Accept": "application/json;odata=verbose"},
type: "GET",
cache: false,
async: false,
}).success(function (data) {
$.each(data.d.results, function(key, value) {
//Project Title
console.log("TEST TITLE - " + value.Title);
Title = "*" + value.Title;
//Project Divison
console.log("TEST DIVISION - " + value.Div);
division = "*" + value.Div;
});
});
});
For further insights on a similar issue, refer to this post: