How to add relationship fields in a PDF Template?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Triggerz
    Member
    • May 2024
    • 95

    How to add relationship fields in a PDF Template?

    Hi,

    I created a pdf template for my entity CCashar. This entity has a one to many relationship to another entity CCasharitems.
    How can I add the fields of CCasharitems in the PDF Template that I am creating for the entity CCashar?

    Thanks & Regards...
  • Paulina
    Member
    • Feb 2022
    • 45

    #2
    Hi, each iterator will help https://docs.espocrm.com/user-guide/...#each-iterator

    Comment

    • Triggerz
      Member
      • May 2024
      • 95

      #3
      Hi Paulina, thank you so much for your answer. It really helped and resolved my concern.

      May I also ask what is the Placeholder for the current user? I wanted to stamp the current user's name and date and time the pdf was generated.

      Thank you so much...

      Comment

      • shalmaxb
        Senior Member
        • Mar 2015
        • 1655

        #4
        Hi, the interface of the PDF templating is very intuitive and makes it easy to get any field of your entity. In the top region you have a drop down field for the available fields of the current entity. So look for "assignedUser" or the translation of that term in your language. The placeholder appears on the right side of the choosen field name, where you can copy it and insert it into your template. It is recommended to do all this work in the HTML-view of the editor.

        The current user (that one, who is logged in) is not available by default, but you may achieve the current user by coding.

        Comment

        • Triggerz
          Member
          • May 2024
          • 95

          #5
          Hi shalmaxb, thanks for your response. In the Formula Script I can use env\userAttribute('name') to get the name of the current user that is logged-in. How can I apply this so that it becomes available in the PDF template?

          Thanks

          Comment

          • shalmaxb
            Senior Member
            • Mar 2015
            • 1655

            #6
            you can use this formula to fill a custom field (e.g. "username") in your entity. Then this field will appear in the dropdown of the PDF template.

            Comment

            Working...