```var xml = file.load({id:'5789'});     var myFil...
# suitescript
r
Copy code
var xml = file.load({id:'5789'});
    var myFile = render.create();
    myFile.templateContent = xml.getContents();
    myFile.addRecord(
      "record",
      record.load({
        type: record.Type.SALES_ORDER,
        id: recId,
      })
    );
    var invoicePdf = myFile.renderAsPdf();
can anybody walk me through whats happening.. from .getcontents i am lost
c
This:
Copy code
myFile.addRecord(
      "record",
      record.load({
        type: record.Type.SALES_ORDER,
        id: recId,
      })
    );
Is the same as:
Copy code
var myrecord = record.load({
        type: record.Type.SALES_ORDER,
        id: recId,
      });
myFile.addRecord(
      "record",
      myrecord );
if that helps?
w
the renderer combines a template (the xml contents) with a data set (the sales order record). Tho if you are printing a PDF from a sales order you can use the advanced PDFs feature and the render.transaction method to avoid having to load both the template and record in one action.