Skip to main content
Question

Document Template creation - Save PDF to field in record

  • March 14, 2025
  • 0 replies
  • 300 views

Forum|alt.badge.img+6

Hi,

I basically imported the following YAML.  And everything is looking ok until it comes to the Body of the “Save File to a Table” Where I am getting a “This field contains invalid jinja references” error.  Thank you so much for helping! Below is the Body (image also below):

{

"to": "bts4ydgrs",

"data": [

{

"340": {

"value": {

"fileName": "{{a.json.fileName}}",

"data": "{{a.json.data}}"

}

}

}

],

"fieldsToReturn": []

}

}

}

]

}

"fieldsToReturn": []

}

The Below is the YAML I imported:

 

# Doc Gen Testing
#

# Account slugs:
#  - quickbase[CHANGE ME]: Realm Default Account <None>
#  - microsoft-outlook[CHANGE ME]:
#    <None>
---
- META:
    name: Doc Gen Testing
- ACTION quickbase[CHANGE ME] quickbase_api make -> a:
    inputs:
      method: GET
      url: https://api.quickbase.com/v1/docTemplates/1/generate?tableId=DBID_CHANGE_ME&format=pdf&pageSize=Letter&filename=Invoice&margin=1
        1 1 1&unit=in&orientation=portrait&recordId=1
    name: Generate Doc
- ACTION quickbase[CHANGE ME] quickbase_api make -> b:
    inputs:
      body: "{\n    \"to\": \"CHANGE_ME_TABLE_ID\",\n    \"data\": [\n      {\n        \"6\"\
        : {\n            \"value\": {\n                \"fileName\": \"{{a.json.fileName}}\"\
        ,\n                \"data\": \"{{a.json.data}}\"\n              }\n      \
        \  }\n      }\n    ],\n    \"fieldsToReturn\": []\n  }\n      }\n    }\n \
        \ ]\n}\n    \"fieldsToReturn\": []\n  }"
      method: POST
      url: https://api.quickbase.com/v1/records
    name: Save File to a Table
    note: 'Write the record '
- LOOKUP quickbase[CHANGE_ME] record look_up -> c:
    inputs-meta:
      table: '"Demo App: Invoice Files" <CHANGE_ME>'
      export_fields: '"File" <6>'
    inputs:
      id: '{{b.json.metadata.createdRecordIds[0]}}'

 

Maria
Forum|alt.badge.img+19
  • Community Manager
  • March 14, 2025

If the data is coming to the Pipeline from the Outlook channel, it should come already in json format that the Pipeline can read and you'll then pull the elements from that by their name. I don't think I've seen .json in the name declared. 

This has been solved without the use of Jinja, Have a look at these posts: 

Outlook Email with Attachments in Pipelines | Qrew Discussions

Can an email attachment be saved to Quickbase using a pipeline? | Qrew Discussions 


Forum|alt.badge.img

I'm on the same boat, looking for possible ways to attach the PDF created in Document Template, but still encountering some issues on the JSON body. I believe the issue is on this line, as I've tried to run each line to determine which one is causing the error.

"data": "{{a.json.data}}"

I wonder if you find resolution on this one already.


JimHarrison
Forum|alt.badge.img+18
  • Registered
  • March 28, 2025

Take a look at the syntax of this. This is not written according to the Restful API documentation. 

{"to": "bts4ydgrs",

"data": [{"340": {"value": {"fileName": "{{a.json.fileName}}",

"data": "{{a.json.data}}"

}}}],

"fieldsToReturn": []}}}

]}

"fieldsToReturn": []}"

 

If we strip down the Restful API to its core these are the key components. Click Request Body tab here for reference: https://developer.quickbase.com/operation/upsert

{ "to": "dbid",

"data": [{ "fid": { "value": "This is my text" }} ],

"fieldsToReturn": [ n... ] }

 

What you have above looks like there is duplicate text. I think you want something more like this but would need to test.

{"to": "bts4ydgrs",

"data": [{"340": {"value": {"fileName": "{{a.json.fileName}}",

"fieldsToReturn": [340]}"