Hello John,
You will need to set the layer name in a variable and then apply it to the layer you are about to add:
var template = new esri.InfoTemplate();
var newLayerName = "new layer name"
var newLayerSearch = "....."
var newLayerURL = "https://..........";
var newLayerFeatureLayer = new esri.layers.FeatureLayer(newLayerURL, {
id: newLayerName,
definitionExpression: newLayerSearch
});
// the following line will provide the layer name displayed on the Layer List:
newLayerFeatureLayer._titleForLegend=newLayerFeatureLayer.title=newLayerFeatureLayer.name=newLayerName
map.addLayers([newLayerFeatureLayer]);
Hope this helps!
Michel Turmel