AnsweredAssumed Answered

Server: SetParameter always writing to scratch (I don't want that!)

Question asked by NZGeoCAD on Nov 9, 2016
Latest reply on Nov 28, 2016 by NZGeoCAD

I've written a geoprocessing script which takes a user drawn AOI from the webmap, does some stuff, then outputs a PDF. The geoprocessing service is accessed through the geoprocessing widget in WebAppBuilder.

The pdfs are written to/stored in a specific directory on our file server as they need to be retrieved for use later through a popup which shows a link to that file (i.e. user clicks on an extent polygon generated each time the tool is run. This shows a popup which gives the details of the PDF map and contains a link to that PDF). In other words, the PDFs are not temporary so writing them to the scratch directory on the server is no what I want to do.


My issue is, no matter what I try I can't get the output parameter to properly display the link- When the geoprocessing tool finishes through the widget, it displays the link as <HostServer>/arcgis/rest/directories/arcgisjobs/geoprocessors/<geoprocessorName>/<JobID>/scratch/<MyFile.pdf>.


The link that I set to the output parameter is (for example):



The link/location is valid because

a) It is available from the server

b) When running the tool before publishing, an addMessage line I've put there gives a string I can paste and access the pdf

c) After the service geoprocess is finished, you can click on the extent polygon and access the pdf through the link written to the attribute table.


No matter what I try I cannot get that link to show as the output parameter after publishing/running as a service! I've tried setting the workspace to my output location in the script and in the environment settings, not setting it etc etc.


I can't paste screen shots as it's on a disconnected server but:

the relevant python is:

out_PDF = os.path.join(out_folder, 'exampleName.pdf)

arcpy.AddMessage("Exporting PDF: %s" %(out_PDF))

arcpy.mapping.ExportToPDF(mxd,out_PDF,data_frame = "PAGE_LAYOUT"

arcpy.SetParameter(9, str(out_PDF)


In the tool parameters, parameter 9 is 

Data Type: File

Type: Derived

Direction: Output

MultiValue: No



Filter: File (.PDF) though have tried this as blank

Obtained from:


Any help would be really appreciated as its been pretty frustrating trying to get something which seems like it should be so easy to work! I just need to display a line of text as a link!