AnsweredAssumed Answered

Custom PrintTask works but returns "Null" for result.url

Question asked by janiceb on Mar 4, 2014
Latest reply on Mar 6, 2014 by janiceb
I have a custom PrintTask which I created following the Advanced Printing Tutorial. When I execute the PrintTask, the pdf is created and resides in the arcgisjobs folder on my GIS Server. I can open the pdf manually but I can not get it to open using The result url is null. If I examine the result object, I see that it is an esri DataFile with a url property that is null.

Has anyone else created a custom PrintTask with different results? How do I get the path and file name returned when the print task completes if the result object does not have the url?

Here is my code:

function advancedPrint(printScale) {     require(["esri/SpatialReference", "esri/tasks/PrintTask", "esri/tasks/PrintTemplate", "esri/tasks/PrintParameters"], function (SpatialReference, PrintTask, PrintTemplate, PrintParameters) {         var printURL = dataLink + "/Test/AdvancedPrint/GPServer/AdvancedPrint"         var printTask = new PrintTask(printURL, { async: true });         var formatOpt = getFormat();         var printLayout = getLayout();         var sr = new SpatialReference(102748);         var printParams = new PrintParameters(); = map;         printParams.outSpatialReference = sr;         printParams.extraParameters = { mapExtent: map.extent, printToScale: printScale };         var printTemplate = new PrintTemplate();         printTemplate.format = formatOpt;         printTemplate.layout = printLayout; // "Letter ANSI A Landscape";         printTemplate.preserveScale = false;         printTemplate.layoutOptions = {             titleText: dijit.byId("txtPrintTitle").value,             authorText: dijit.byId("txtPrintAuthor").value,             copyrightText: "Copyright 2014",             scalebarUnit: "Miles"         };         printParams.template = printTemplate;         // Progress bar         var i = 0;         var progressBar = dijit.byId("progressBar");         var progressGo = setInterval(function () {             progressBar.set("value", i++ % 100);         }, 300);         setTimeout(function () { clearInterval(progressGo); }, 10000);         // Execute Print Task         printTask.execute(printParams, printComplete);     }); }  function printComplete(result) {;     var progressBar = dijit.byId("progressBar");     progressBar.label = "Print Complete"; }