How to get fields of Dynamic Layer hosted by ArcGIS Server using JavaScript?
You can create a FeatureLayer object from the REST endpoint URL, and get the information from its fields collection after it loads:
const featureLayer = new FeatureLayer({ url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0" }); featureLayer.when(function() { featureLayer.fields.forEach(function(field) { console.info(field.name + " ( type: " + field.type + ", alias: " + field.alias + " )"); }); }); featureLayer.load();
@JoelBennett
Thanks.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.