This topic contains 2 replies, has 0 voices, and was last updated by michoel 7 years, 8 months ago.

  • Author
    Posts
  • #2328 Score: 0

    MNeedhamRyonet
    • Contributions: 0
    • Level 1

    I am trying to print two different records in one PDF

    Here is the back story

    I am actually trying to access the sublist of a transaction record from a custom record that I am printing as a PDF but cannot seem to do that so I thought…. Wait can’t I just get the first record with one template then get the second record with another template and print them both. I can render one or the other but how do I do both at the same time. its only two record
    This is a cached copy. Click here to see the original post.

  • #2329 Score: 0

    MNeedhamRyonet
    • Contributions: 0
    • Level 1

    So I tried this and it did not work

    I created two separate xml strings and combined them. Thought that would be a great idea… now I see why not but sure did give it a shot.

    Error Parsing XML: XML document structures must start and end within the same entity.

  • #2330 Score: 0

    michoel
    • Contributions: 0
    • Level 1

    If you are able to change the template you can do it like this:

    Code:
    var record1 = nlapiLoadRecord(…);
    var record2 = nlapiLoadRecord(…);
    var renderer = nlapiCreateTemplateRenderer();
    renderer.setTemplate(…);
    renderer.addRecord(‘record1’, record1);
    renderer.addRecord(‘record2’, record2);
    var xml = renderer.renderToString();
    var file = nlapiXMLToPDF(xml);
    If you can’t change the template, you could edit the generated XML strings to wrap them in a . You would have to remove the from both rendered strings, and wrap the combined strings in –

    Code:

    {{ your two generated XML strings }}

You must be logged in to reply to this topic.