^^^^^^ I've been able to create a suitelet that re...
# advancedpdf
j
^^^^^^ I've been able to create a suitelet that returns the current work order record and displays it into an xml template for printing. The only problem is that it does not include the associated assembly record for the work order. Can anyone provide some insight as to how to "attach" the assembly record to the workorder record. Below is a sample of the code in my suitelet that I am using. This was modeled from our knowledgeable friend. @michoel
Copy code
/**
 * Suitelet to print Work Order
 *
 * Script ID: customscript_ssww_print_workorder_sl
 * Script Type: Suitelet
 *
 */

function print_workorder(request, response) {
  try {
    var id = request.getParameter('custom_id');
    if (!id) {
      response.write('custom_id parameter missing');
    }

    var record = nlapiLoadRecord('workorder', id);
    var renderer = nlapiCreateTemplateRenderer();
    var template = nlapiLoadFile('SuiteScripts/Advanced PDF Forms/custtmpl_ssww_bom_template.xml');
    renderer.setTemplate(template.getValue());
    renderer.addRecord('record', record);
    var xml = renderer.renderToString();
    var pdf = nlapiXMLToPDF(xml);
    response.setContentType('PDF', 'print_workorder.pdf', 'inline');
    response.write(pdf.getValue());
  } catch (err) {
    response.write(err + ' (line number: ' + err.lineno + ')');
    return;
  }
}