I am unable to read a value from an Xrm.WebApi request in my Javascript. I have tested using Executed Code in CRM REST Builder, and results are indeed retrieved.
Below is my code snippet:
Xrm.WebApi.online.retrieveMultipleRecords("percentile", "?$select=maleage").then( function success(results) { for (var i = 0; i < results.entities.length; i ) { var ccc_maleage = results.entities[i]["maleage"]; } }, function(error) { Xrm.Utility.alertDialog(error.message); } );
When comparing the values in Javascript:
for (index = 0; index < results.entities.length; index) { alert("results.entities.length: " results.entities.length); //displays 18 var age = results.entities[index].maleage; alert("age: " age); //always displayed as "undefined" if (months == age) { //no match due to "undefined" age } }
May I know what have I done wrongly? This issue has been occurring On and Off, and it is very unstable.