I'm performing a MapView.hitTest() against a feature layer in a webmap and running across inconsistencies with attributes being returned. I get a reference to the feature layer and set the outFields I want returned. However, sometimes the graphic that is 'hit' only returns the ObjectId. Other times it returns all attributes specified in outFields.
view.on("click", function (event) {
view.hitTest(event).then(function (response) {
if (response.results.length) {
var graphic = response.results.filter(function (result) {
return result.graphic.layer === myLayer;
})[0].graphic;
// graphic.attributes only contains objectid
// OR
// graphic.attributes contains objectid, att1, att2, att3, etc...
}
});
});
What is the expected behavior? For instance, should you assume that you may only get back an ObjectId and not additional attributes set through FeatureLayer.outFields? Does hitTest ignore outFields?