[Doc Merge] - Library of Errors

Hi all,

I have been using docmerge for the last few days and come across a bunch of errors which im not finding overly helpful. I was wondering if anyone/sugar had compiled a list with troubleshooting steps?

a few:

malformed table

{insert field name} is not defined

Also, don't seem to be able to use IF conditions in excel templates.

  • Hi Ross. Sorry to hear you're having trouble using Doc Merge! We will work on making the Doc Merge errors more meaningful and providing more documentation to help you troubleshoot. Thanks for the tip!

    In the meantime, here is some technical meaning behind the errors you encountered (which you may or may not care about) and some suggestions for troubleshooting:

    • Malformed table: This is a parser error and means that the parser was unable to create readable xml tags. We suggest manually recreating the table and making sure the collection tags (e.g., {#calls} ... {/calls}) are in the proper cells. Start with a simple table and then build up complexity.
    • {insert field name} is not defined: This is a metadata error and it might mean that your metadata is out of date or that the tag is incorrect. Please recheck the field name that you are using is correct.
    • Unexpected identifier: This might mean that the field name is wrong. Please check your syntax.

    Right now conditionals in Doc Merge only work with Microsoft Word. We are looking into expanding this capability to Excel in the future. 

    You may find the help article on Sample Doc Merge Templates to be helpful to see how an example Excel template is set up, for example.

    Let us know if we can provide any more help!

    Lydia Manger

    Product Manager — Sugar Discover

  • Thanks for this Lydia. Very helpful. I do have one further query, if you don't mind answering? It is regarding looping over product bundles when producing a quote doc. I want to filter by the name of the bundle but cannot seem to get it to work. Am i being dumb?? the below works but shows me all of the bundles

    -----

    {#product_bundles}

    {if product_bundle_items.name==”Additional Items”}

    {name}

      

     

    Additional Items

     

     

    {#products}{name}

    {quantity} No

    {discount_price} Each

    {subtotal} Total {/products}


    {/product_bundles}

     -----

  • I have not tested myself, but I believe it is enough to enter "{if name==”Additional Items”}" as you are already looping through all product_bundles.  And then you need an ending if statement {endif}

    Hope this helps

  • Annoyingly im getting this with just {ifname=="Additional Items"} (and the endif of course) 

    Error: Invalid or unexpected token

    another unhelpful error message

  • hi

    have you tried to use single quotes instead of double?

    There is some confusion when to use one style or the other, even on the official

    knowledgebase here they give examples using both:
    https://support.sugarcrm.com/Knowledge_Base/Doc_Merge/Filtering_with_Conditionals/ 

    Not sure if Sugar product development team can remove this confusion?

    .

    CRM Business Consultant

  • Unfortunately doesn't work either way. wondering if name is just to much of a variable to use as a filter.

  • I'd like to preface this with saying I don't have Sell or Serve, I work on Sugar Professional on Site deployment, so I have ZERO experience with DocMerge.

    Having said that, I tend let curiosity get the best of me...

    Have you come across the example they have for quotes in the Knowledge Base yet?

    FrancescaS

  • You said:
    "Annoyingly im getting this with just {ifname=="Additional Items"} (and the endif of course) "

    is the space missing just in your post or also in your template?
    {if name=="Additional Items"}

    instead of

    {ifname=="Additional Items"}

  • Thanks for the follow up question, Ross. I'm sorry it took a few days to return to this. I think I have a solution for you (if I understand your case correctly)! See the attached image to see what I saw in Sugar (a group of items with the name "Additional Items"), what I saw in Word, and then what I saw in the merged doc. Note that I also got an "Error: Invalid or unexpected token" message (I agree, we need to update it!). All I did was change the quotation marks around "Additional Items" in word to use the Unicode character 0022 (go to Insert > Advanced Symbol and find the "). I know there are various pieces of software where smart quotations do not work well, and I am guessing that is what the issue is here (or something similar). Please try replacing any quotation marks with unicode characters to ensure that there is no secret formatting getting passed. 

     

    I notice in your post above that you used "if product_bundle_items.name...." and I wonder where you got that syntax from. Luckily the others were able to give you the tip that you only need to use "name". I thought I'd point out something that you may not have noticed (I didn't notice it at first either!). In the Doc Merge Template Assistant, once you choose a module and then a related module click the gear icon to the right of the related module. You can then click into the Fields field and select the field you want to pull from Product Bundles (in this case, name) and see the syntax with the proper formatting. In your case you then used the filter "if", but this may help you get to the correct syntax for the field names. 

    I hope this helps get you to where you need to go! Please let us know if you need anything else!

    Lydia Manger

    Product Manager — Sugar Discover