function main(req, res) {
var estimateId = req.getParameter('estimateid'); // What is the Id for the Estimate.
var salesorderId
nlapiLogExecution('debug', 'start: ' + estimateId, req.getParameter('templateId') + ' ' + req.getParameter('format'));
if (estimateId && req.getParameter('templateId') && req.getParameter('format')) {