Announcement

Collapse
No announcement yet.

How I can print mobile numbers list at lead pdf template ?

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

  • How I can print mobile numbers list at lead pdf template ?

    Hi, I need some help. please tell me how can I print the list of the mobile numbers in the pdf report. my lead entity template code is


    {{#each phoneNumberData}}

    {{./type}} Type <br>
    {{phoneNumber}} Phone

    {{/each}}

  • #2
    Please Help its urgent

    Comment


    • #3
      Hi aliwaqas,

      This lines should not be inserted in Code View mode (with a black background, as you did earlier), but in normal mode, with a white background and black text:
      Code:
      {{#each phoneNumbers}}
      
          {{type}} Type 
          {{name}} Phone
      
      {{/each}}

      Comment


      • #4
        @lazovic Thanks a lot brother you are great . its working

        Comment


        • #5
          Any chance it could print the formatted number ? For example, in my database table phoneNumber the `name` column is saved as (###) ###-#### and the numeric column is ##########. I tried your code lazovic and it still shows only the numeric number.

          Comment


          • #6
            I think you have to use Formula to transform the number format then use that... I dont think PDF support transforming these "string" like feature yet.

            Maybe digging through domPDF you might find a solution...

            Sorry can't assist.
            Last edited by esforim; 04-20-2023, 08:16 AM.

            Comment


            • #7
              Shouldn’t {{name}} above be giving me the exact db string in phoneNumber.name as it is stored in db though?

              Comment


              • #8
                `name` column is saved as (###) ###-####

                Do you have an extension for field formatting? I know there is a Paid Mask Field extension that show like so.

                As far as I know it get format the way you write it.

                Comment


                • #9
                  Hi, Yes. I use the paid mask field extension. It turns out I was looking at the wrong db entry before I had that extension and the record wasn't formatted with the mask. Updating the record solved the problem. Also, If anyone ever wants to know what is in {{phoneNumberData}} for an entity when printing to PDF it can be done like so
                  Code:
                  {{#each phoneNumberData}}
                  Index: {{@index}}
                  {{#each this}}
                  <p>{{@key}}:{{this}}</p>
                  {{/each}}
                  <br>
                  {{/each}}​

                  Comment


                  • esforim
                    esforim commented
                    Editing a comment
                    Interesting code, I see @index and @key. I don't remember ever writing these two code before.

                • #10
                  Interesting output:

                  Click image for larger version

Name:	image.png
Views:	206
Size:	26.6 KB
ID:	91423

                  Comment


                  • czcpf
                    czcpf commented
                    Editing a comment
                    That code is just to see the available data in phoneNumberData. Espo will also give you a field called {{phoneNumber}} as well which will just be the primary phone number. I think if you want to display other types besides primary you have to loop through like:

                    {{#each phoneNumberData}}
                    {{#ifEqual type "Office"}}
                    {{type}}:{{phoneNumber}}
                    <br>
                    {{/ifEqual}}
                    {{#ifEqual type "Mobile"}}
                    {{type}}:{{phoneNumber}}
                    {{/ifEqual}}
                    <br>
                    {{/each}}​

                  • esforim
                    esforim commented
                    Editing a comment
                    Hi czcpf, seeing many good code from you.

                    I say it interesting because it help with 'debug'. I wonder if it possible to use it for all other field as well. And the new example is good too! I might just directly copy/paste and steal this code in our PDF Template.
                Working...
                X