You just need to specify the Feature Layers fields and outFields properties in that sample.
var featureLayer = new FeatureLayer({
popupTemplate: popupTemplate,
objectIdField: "FID",
source: graphics,
outFields: ['*'],
fields: layer.layerDefinition.fields
});