AnsweredAssumed Answered

Create feature layers by layer name

Question asked by greenkarmic on Apr 26, 2012
Latest reply on May 1, 2012 by DSwingley-esristaff
I have a MapService with several layers. This list of layers may change in the future, some layers might added, some removed, order could be changed, etc... So when I create my FeatureLayer objects, I can't simply hardcode the numeric index of each layer for the URL parameter, like demonstrated in all the examples.

1. Is it possible to create a FeatureLayer according to the layer name in the Map service?
2. If not, what is the best way to obtain the list of name/index pairs provided by the map service (so that I can then use the correct indexes to create my FeatureLayer objects)?

Thank You