I can get the fields from a Feature or a FeatureSet using the Schema function and cycling through the fields key
var output = []
var fields = Schema(item).fields;
for (var f in fields) {
Push(output, fields[f].name)
}
return {
type : 'text',
text :Concatenate(output, ', ')
}
For a Feature, in AGOL, the fields are returned in alphabetical order (with the exception of OBJECTID). In ArcGIS Pro, they are returned in their original order. These two screenshots use the same item from AGOL and the same code in the Arcade element


For a FeatureSet, the order of the fields depends on how I get that FeatureSet. If I get it from the map using FeatureSetByName, the fields are returned in alphabetical order. If I get it from the Portal using FeatureSetByPortalItem, they are returned in their original order.

Why isn't this consistent?