Cannot format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nocstaff@urbancom.net
    Member
    • Jul 2025
    • 54

    #1

    Cannot format

    I made a custom entity called total job time, and I tried to make an entity based report template that includes this. However, it calculates in the report as seconds. I tried to adding formation coding in the html like

    HTML Code:
    <strong>Total Job Time:</strong> {{duration\format(duration)}}
    and I also tried to calculate it within the html and produce that output like here

    HTML Code:
    <tr>
    <td style="width:50%;">
    <strong>Completion Time:</strong> {{dateEnd}}
    </td>
    <td style="width:50%;">
    <strong>Total Job Time:</strong> {{duration\format(duration)}}
    </td>
    </tr>
    but nothing I tried worked, it always ended up with either a blank response or an error 500. I also tried to add a formula script before save custom script, but that usually just ended in an error too. How can I fix this?
    Attached Files
  • victor
    Active Community Member
    • Aug 2022
    • 1002

    #2
    Report Template is not a regular PDF Template - it is more complex and the possible customizations here are very minimal.

    You edited the Report Template and inserted {{duration\format(duration)}}. Who advised you to do this?

    What does your Report look like?

    Comment

    • nocstaff@urbancom.net
      Member
      • Jul 2025
      • 54

      #3
      I just looked up how to change duration formatting and it was one of the first results from google's AI Overview. I'm still pretty unfamiliar with what is and isn't allowed when trying to format reports with html coding, since it doesn't seem to be purely html, and it seems like a lot of terms just gets ignored, so it's been a matter of trial and error for me. I know there's 2 ways of making a report to a pdf, I am doing it through this method: https://www.espocrm.com/tips/pdf-template/

      If it helps you, this is what the full html code is for the template, and attached is a screenshot of what it generates

      HTML Code:
      <h1>Daily Log {{date}}</h1>
      
      <table cellpadding="5" cellspacing="0" width="100%" nobr="true" style="margin: 0;">
        <tbody>
          <tr>
            <td style="width:25%;">
              <strong>Log Type:</strong> {{type}}
            </td>
            <td style="width:25%;">
              <strong>Status:</strong> {{status}}
            </td>
            <td style="width:25%;">
              <strong>Account:</strong> {{parentName}}
            </td>
            <td style="width:25%;">
              <strong>Case:</strong> {{casesNames}}
            </td>
          </tr>
          <tr>
            <td style="width:50%;">
              <strong>Dispatch Time:</strong> {{dateStart}}
            </td>
            <td style="width:50%;">
              <strong>Arrival Time:</strong> {{arrivalTime}}
            </td>
          </tr>
          <tr>
            <td style="width:50%;">
              <strong>Completion Time:</strong> {{dateEnd}}
            </td>
            <td style="width:50%;">
              <strong>Total Job Time:</strong> {{duration}}s
            </td>
          </tr>
          <tr>
            <td style="width:100%;">
              <strong>Description: </strong> {{{description}}}
            </td>
          </tr>
          <tr>
            <td colspan="4" style="height: 20px; border: none;"></td>
          </tr>
        </tbody>
      </table>
      Attached Files

      Comment

      Working...