There's two ways of passing extra information into your JavaScript PrintTask, depending on what you want to do with them.
If you need to pass in custom parameters to handle logic within your custom GP tool, you should use the PrintParameters.extraParameters property. For example:
params.extraParameters = {
"lost": false,
"found": true,
"name": "John Doe",
"answer": 42
};
params.extraParameters.MyNewParameter = 'testing';
If you're simply inserting new text into your map, you can use the customTextElements property of your PrintTemplate.layoutOptions to insert them.
- In ArcMap, when you're editing the map you're going to use for the print template, add text using the drawing toolbar.
- Double-click on the textbox to bring up its properties.
- Under the Size and Position tab, there's an "Element Name" blank. Fill that in with a unique tag name (like an id in HTML)
In your JavaScript app, when you're updating your print template, add those tags and the custom text you want to insert in them. For example:
ptemplate.layoutOptions.customTextElements = [
{"rightlabel": "East"},
{"leftlabel": "West"},
{"subtitle": "Check out this great map!"},
{"disclaimer": "Don't sue me if you get lost using this map."}
];
ptemplate.layoutOptions.customTextElements[0] = {"almost_forgot":user_text};
The advantage of this is that it is faster to insert text than iterating through the text elements and replacing elements in ArcPy.