Referencing layers in ArcGIS Services Directory

Discussion created by njehw2 on May 16, 2012
Latest reply on May 16, 2012 by esrijay
I know you can reference different layers by using the ID number in provided by the ArcGIS Services Directory. But, when a new service is added sometimes the number changes and as a result you web map references the wrong service.Is there a way to reference the correct service without using the ID provided by the ArcGIS Services Directory? May be the service name and if so is there any examples in javascript?