Forum Discussion
Yes, I'll give you the info but I can't take the credit. Taylor Hardy at Quickbase did the work. In this case, we use it to send to Outlook, but you can change it to a file attachment field.
Here is the yaml:
# 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]}}'
- ACTION microsoft-outlook[CHANGE_ME] email send_email_attachment -> d:
inputs-meta:
attachments:
name: '{{c.file.file_name}}'
url: '{{c.file.file_transfer_handle}}'
inputs:
body: Testing writing doc to QB table, looking up that record to get the file
transfer handle, then emailing it using the outlook channel
subject: Doc Gen Testing
to_addresses: CHANGE_ME
...
Does anyone have the above with actual data filled in as an example? It's not readily apparent to someone without specific YAML experience what some of the references are to data that needs to be customized. The "change me" slug, table id, field references I get. It's mostly the action body I'm having trouble with. Also, I need this just to save the pdf document from the template to a table, not the email section. Thanks.