AnsweredAssumed Answered

Geoprocessing Service Layer Names Changed as Part of Publishing Process?

Question asked by jadams9 on May 9, 2018

When I publish a Python script tool as a geoprocessing service directly (Share -> Publish a service), layer names that come in as Feature Layer parameters from a list of layers in the current map get changed to "ServiceName\LayerName" (ie, "EncroachmentPermitGenerator\mySDE.SDEuser.encroachment_permits_current"). When I publish the script using 'Save a service definition file' (with 'No available connection') and then the Upload Service Definition tool, the layer name comes through unchanged (ie, "mySDE.SDEuser.encroachment_permits_current").


For example, I had to change this line from 'if = permit_layer' to 'if in permit_layer' because the mxd's layer name didn't have the service name prepended to it. A simple change, to be sure.


Is this the expected behavior? When writing scripts for Geoprocessing Services, should I anticipate the service name being prepended to any layer name parameters?


(The save as a definition -> upload definition process was a workaround for our older 10.4 server that, for whatever reason, didn't recognize the data being registered in the data store. This might be related to BUG-000098784 and BUG-000100260 from the 10.5 and 10.6 release notes, but I'm not certain—I figured out the workaround and moved on.)