Announcement

Collapse
No announcement yet.

Template : Show list of attended meetings of a contact

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

  • Template : Show list of attended meetings of a contact

    When creating a PDF template for entity person, there is no way to do list the meetings that the contact
    attended, since meetings<>contact is an N:N relation.

    Any workaround for this?

  • #2
    Hello,
    in espoCrm < v6.x you can use in service :

    loadAdditionalFields
    loadAdditionalFieldsForPdf

    make some search about theses functions

    in espoCRM > v6.x .. ?


    Comment


    • #3
      This one should work? It does for me at least. Here is my setup:

      Contact name: Test Person
      Meeting (1): Test meeting name 11
      Meeting (2): Test Contact Meeting 2021

      Template Entity type: Contact

      Code I used (auto):

      Code:
      {{#each meetings}}
      
      Meeting name: {{name}}
      
      {{/each}}
      This code you need to use manual mode (press <> button)

      Code:
       <table>
      <!-- {{#each meetings}} -->
      <tbody><tr>
      <td>{{name}}</td>
      </tr>
      <!-- {{/each}} -->
      </tbody></table>
      These will list all meeting for you. I haven't tried it with Meeting > list all Contact but I believe it should be same concepts, just replace it meetings to contacts or contact(?)
      Last edited by esforim; 01-12-2021, 02:58 AM.

      Comment


      • esforim
        esforim commented
        Editing a comment
        Yes, just tested it. I use the same code above but change 'meetings' to 'contact' (Tips: also change to Entity Type: Meetings, using duplicate won't work, cause it lock into that Entity, you need to copy the code, create new Template, then paste the code, then update 'meetings' to 'contacts'

        Sample code:

        {{#each contacts}}

        Contact attending meeting's name: {{name}}

        {{/each}}

    • #4
      I did ran into a problem though. I'm trying to expand this template to have Maps function too but for some reason the Google maps code not working anymore for me. Previously it was working in <v6 but now that I tried it I'm getting an error in console log.

      Anyone still can use Google Maps printing? For reference see: https://docs.espocrm.com/administrat...rinting-in-pdf

      I tried all these variation of code:

      {{googleMapsImage city='New York' country='United States'}}
      {{_googleMapsImage city='New York' country='United States'}}
      {{_googleMapsImage field='address' size='600x225' zoom='18'}}
      {{_googleMapsImage field='name' size='600x225' zoom='18'}}

      The demo version doesn't include an API so I can't test it.

      Comment


      • #5
        Hello,
        i have no google map api. (what is error log ?)
        this tag defined : application/Espo/Resources/metadata/app/templateHelpers.json
        "googleMapsImage": "Espo\\Classes\\TemplateHelpers\\GoogleMaps::image "

        search in application/Espo/Classes/TemplateHelpers/GoogleMaps.php
        here you can see what's it's require

        good luck



        Comment


        • #6
          I haven't change any code and the default code should still work, especially the sample code: {{googleMapsImage city='New York' country='United States'}}

          Here is the error:

          Code:
          Espo.ERROR: Uncaught Exception Error: "Class 'Espo\Core\TemplateHelpers\GoogleMaps' not found" at /tmp/lci_MG7hdY line 119 {"exception":"[object] (Error(code: 0): Class 'Espo\\Core\\TemplateHelpers\\GoogleMaps' not found at /tmp/lci_MG7hdY:119)"} []
          I checked the file and it still there, the actual file location is at:
          application/Espo/Classes/TemplateHelpers/GoogleMaps.php /

          For reference: https://github.com/espocrm/espocrm/b...GoogleMaps.php

          I download the file and upload it to in case my file got corrupted. Tried to PDF image with the code

          {{googleMapsImage city='New York' country='United States'}}

          But this time there is no error but there is no image either (blank)

          Comment


          • item
            item commented
            Editing a comment
            Hello,
            strange, have you do a clearCache and rebuild ?
            it's old version <v6 path for classes.
            put in log in debug mode and see log file when create a pdf.

        • #7
          #3 from esforim is correct :

          {{#each meetings}} Meeting name: {{name}} {{/each}}

          Thank you

          Comment


          • #8
            Hey guys,

            Apologies to bring this post back from the dead, but I feel like this post should be re-producible across other entities. For instance, in my case, I simply need to output multiple unique Contacts assigned to a given Account. This is for a Printable PDF 'Quick Info Summary' for an Account for Sales Reps to bring to in-person on-site customer visits.

            My template skeleton:
            Template Format

            My code for this template to bring in an Account's contacts:
            Template Contacts Code

            However, this just dumps the same contact each time:
            Report Template's Output

            When there are multiple Contacts under the respective Account that I'm trying to output to my Print-to-PDF Template:
            Contacts to be Output to PDF

            I know this should be possible, I'm just not sure what's missing from my template's code syntax to achieve this...

            Any ideas??

            Comment


            • #9
              I believe you break it when you decide to create a nice looking table like there, here how I did mine with Cases > Contacts. The code is raw data, try adopting it for you and see if it work then you can change to the right Entity name and it should work. As you can see, it is not fancy like yours but it does use the table.

              Second issue is I break it into 2 tables, why? Because I'm using Portrait mode and don't have enough space, hence the double data of Name. I think most field is normal, date of birth is a custom field of ours I think.

              Code:
              <table>
               <!-- {{#each contacts}} -->
                  <tbody><tr>
                    <td><p>{{name}}</p></td>
                    <td><p>{{dateOfBirth}}</p></td>
                    <td><p>{{phoneNumber}}</p></td>
                    <td><p>{{emailAddress}}</p></td>
                  </tr>
               <!-- {{/each}} -->
               </tbody>
              </table><br><p></p><p>
              </p><table>
               <!-- {{#each contacts}} -->
                  <tbody><tr>
                    <td><p>{{name}}</p></td>
                    <td><p>{{addressStreet}}</p></td>
                    <td><p>{{addressCity}}</p></td>
                    <td><p>{{addressPostalCode}}</p></td>
                  </tr>
               <!-- {{/each}} -->
               </tbody>
              </table>​

              Comment

              Working...
              X