Announcement

Collapse
No announcement yet.

Loop in PDF Template?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loop in PDF Template?

    Hi,

    Is it possible to loop in PDF templates? e.g. for i=1 to 4. This is so we can print a seperate PDF page for each QTY of an item that has been ordered. I have looked at each but this doesnt seem to offer this functionality.

    Thanks,


  • #2
    I don't believe that there is a specific for n to x loop handlebars helper in Espo, but you can develop your own or maybe adapt the "each" iterator.

    https://docs.espocrm.com/user-guide/printing-to-pdf/#each-iterator


    Comment


    • #3
      Ok, thanks will take a look at that. I previously had it working using an ENUM field that was updated to hold the QTY and then using the each iterator but unfortunatly this stopped working with the newest update with Validationfailure error messages.

      Comment


      • shalmaxb
        shalmaxb commented
        Editing a comment
        I many cases the validation problem is possible to be solved. For example, if your enum is a mandatory field, it could help to take away the mark for mandatory and it could work again. I even had cases, where I unmarked and later marked again and it continued working.
        In general it is worth to look for the reason of the validation error, what not is very easy, but possible.

    • #4
      An easy work around the rigid enum validation rules, when working with dynamically defined enum field options, is to set the options as null in the metadata definition of the field.

      The validation enforcement mechanism will ignore enum fields which options is set to null. Try this.

      Comment


      • #5
        I tried to set it to null but I still get the Validation Failure errors...

        "qtyArrayforPrinting": {
        "type": "multiEnum",
        "storeArrayValues": true,
        "style": {},
        "isCustom": true,
        "options": [null],
        "allowCustomOptions": true
        }

        Comment


        • telecastg
          telecastg commented
          Editing a comment
          should be

          "options": null

          NOT "options": [null]
      Working...
      X