This topic contains 6 replies, has 0 voices, and was last updated by MarkZSSI 8 years, 1 month ago.

  • Author
    Posts
  • #2315

    MarkZSSI

    I have a packing slip where I want to include another XML file into the final output. XML Include and XML XInclude don’t seem to getting the results done.

    This code here works fine, but I have around ~45 packing slips, and it really isn’t optimal to have to make ~45 changes everytime a box type changes.

    Code:


    BOX XXXXX
    #if>

    BOX YYYYY
    #if>


    Packing Slip
    Date: ${record.trandate}
    The above works to put a box type code on the packing slip.

    I tried this, and it doesn’t work:

    Code:


    Packing Slip
    Date: ${record.trandate}
    Any ideas how I can include another XML file inside an XML packing slip?
    This is a cached copy. Click here to see the original post.
  • #2316

    chanarbon

    Hi @MarkZSSI,

    I am not pretty sure whether this could be achieved by simple customization but I think this could be achieved using scripting. What you could do is to perform a convert the templates into string, concatenate the strings and convert back to XML document then perform the printing. The mentioned method is pretty much easy because the step 1 and step 3 are available in XML APIs for SuiteScript 1.0 or xml module in 2.0. The last action which is printing is in Record APIs in SuiteScript 1.0 and render module in SuiteScript 2.0

  • #2317

    michoel

    You can use the Freemarker “#include” directive to achieve this.

    http://freemarker.org/docs/ref_directive_include.html

  • #2318

    MarkZSSI

    Thanks for responding to this!

    1. chanarbon – this sounds like a confusing way to do something that should be really simple.

    2. michoel – I might give that a try.

    Update: I did solve this by creating a custom field and setting up a workflow. But option #2 seems worth testing, as I don’t want to have to add a custom field unless it’s absolutely the only way to do this.

  • #2319

    MarkZSSI

    michoel – #include doesn’t work. Thanks, but I think I’ll just stick with what does work. Custom field and workflow.

  • #2320

    michoel

    Originally posted by MarkZSSI

    View Post

    michoel – #include doesn’t work. Thanks, but I think I’ll just stick with what does work. Custom field and workflow.

    It certainly does it, I use it in every one of my templates. Make sure that the URL you are using is an absolute path, and if you are hosting the file in your NS File Cabinet it is ‘Available Without Login’.

  • #2321

    MarkZSSI

    Originally posted by michoel

    View Post

    It certainly does it, I use it in every one of my templates. Make sure that the URL you are using is an absolute path, and if you are hosting the file in your NS File Cabinet it is ‘Available Without Login’.

    I tried different ways to access the file. It didn’t work. No worries, as I have other projects and as long as something works, I can move on to the next business need. Hopefully in the future I’ll get to have more time to work on #include and see if I can get it to work.

    I do appreciate the response!

You must be logged in to reply to this topic.