PrintTask - How to set the ExportWebMap JSON on PrintTask

Discussion created by VBCrazyCoder on Jun 5, 2014
I am trying to figure out how to print without a map UI.  I want to save ExportWebMap JSON out to a file for later use.  The requirement is to be able to select several saved maps to print from a list (so no map UI).  My plan was to save the ExportWebMap JSON when they save the map initially so I can just retrieve it and send it in the PrintTask.

I have seen posts related to this such as:

and looks like I will have to generate my own ExportWebMap JSON and post it to the GIS server for export.  Any shortcuts on generating the ExportWebMap JSON?  Another post mentioned using printTask._getPrintDefinition() just for getting some of the JSON, but that throws me an error "Unable to get property layerIds of undefined or null reference".  Any other things I could try to get some of the ExportWebMap JSON or am I stuck with an all manual creation of it?

Let me know if there are any ideas out there or if anyone has implemented something similar.  Thanks!