import arcpy MXD=arcpy.mapping.mapdocument('current') #get access to the current mxd dataframe = arcpy.mapping.ListDataFrames(MXD, "Layers")[0] #grab the dataframe object you want (probably named Layers) dataframe.zoomToSelectedFeatures() #zoom to the feature in memory arcpy.RefreshActiveView() #refresh the map so that the extent change shows up
What needs to change in this code for it to be able to be published as a geoprocessing service? This code works for me in Desktop, but Server does not like the "current" mxd......
Try changing the 'Current' keyword to a path to an mxd