Abstraction for index numbers to select specific feature layers in a mapservice

Discussion created by bpangtay on Aug 26, 2013
Latest reply on Aug 27, 2013 by timsparq
If an MXD is modified, the index number for a layer in a mapservice may change since it just a relative number derived from the order in which the layers were added to an MXD. When that happens, the developer needs to track down all relevant code that specifies that index number and correct the index number to new modified index number.

Is there a different method that does not use index numbers to specify the layer desired from a mapservice?