Announcement

Collapse
No announcement yet.

Sending variables to PDF template

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

  • Sending variables to PDF template

    Hello, I have a small problem.

    I have an override of Quote.Record.Panels.Items view and I have created a new variable here like this:

    data: function () { return { objects: this.objectList } }

    I see this variable in my Quote view, but now the problem is that when I try to convert this Quote to PDF - I can't reach the "objects" variable in the PDF template. How could I send this variable to PDF template? If I use the objects variable inside the PDF template I get an empty result.
    Last edited by The50; 01-30-2018, 03:25 PM.

  • #2
    Hello
    For PDF are valuable only server field values, data: function () is used only for the view

    Comment


    • #3
      Originally posted by tanya View Post
      Hello
      For PDF are valuable only server field values, data: function () is used only for the view
      So in order to print my new variable into PDF file I have to make a calculation on PDF creation module OR try to save this value in the database or something? Maybe overwriting the PDF module and calculating this custom field would be better idea?

      Comment


      • #4
        Define for your Entity a custom service with method loadAdditionalFieldsForPdf and set the value for needed field

        Comment


        • #5
          Originally posted by tanya View Post
          Define for your Entity a custom service with method loadAdditionalFieldsForPdf and set the value for needed field
          Do I have to register my custom variable anywhere else first? As example I try this:
          $entity->set('testing', 100); In function loadAdditionalFieldsForPdf And I call this like {{{testing}}} in my PDF template, and I get nothing. The same with the new array I want to add.

          Comment


          • #6
            Yes, you need to define the field in entityDefs and set at least a type. Also you can add "notStorable"

            custom/Espo/Custom/Resources/metadata/entityDefs/{YourEntity}.json
            {
            "fields" : {
            "testing": {
            "type": "varchar",
            "notStorable": true
            },
            }
            }

            Comment

            Working...
            X