TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
How to attach a newly generated Document to the current record
Hi, one of my clients has an Action of type Email Alert which generates a Document and attaches it to an Email. They would now like to attach (upload) that newly generated document file to the TeamDesk record that generated the document.
Do I need to use a Call URL action for that? If so, can someone help me with the code to get it from the user's "Downloads" folder to the correct record and field in the database?
We have a File Attachment field called "Letter Document" where the document needs to be stored.
I know they can manually upload it from the Downloads folder, but ideally they would prefer to have it done automatically.

Any help much appreciated. Thanks. Luison
ID
1511
Category
Integration/API
Author

Luison Lassala
Date Created
3/1/2022 9:29:49 AM
Date Updated
3/1/2022 11:16:58 AM
Comments
Scott Miller 3/1/2022 9:49:21 AM
Hi @Luison if memory serves me right you create formula-url column of the type
https://acmecorp.dbflex.net/secure/api/v2/<App id>/<API Token>/<Table Name>/<Document Name>/document?id=" & RecordId()
Then simply assign this column to an attachment column as part of a workflow action

Luison Lassala 3/1/2022 10:19:06 AM
Thanks @Scott - that looks very promising.
Are you sure I need the <Table Name> rather than the table id (t=951702)
and the <Document Name> rather than the Document id (document=206760)?
If those names have spaces, do I enclose them in "" (e.g. "CONFIRMATION LETTER").

I presume the <API Token> I get from the "REST API Authorization Tokens" in the Database, clicking on NEW and copying the newly generated Token (1DC6556EDC614E278FBF72A3FD%&$£9).

Maybe if you could include in your response a sample URL for a document from one of your databases, with a fake Token obviously, that would be very useful.

Many thanks again.
Scott Miller 3/1/2022 10:26:11 AM
@luison here is the url and yes generate the token from the API Section. I generally assign a dummy user as the impersonator that only has access to the Table in question

"https://acmecorp.dbflex.net/secure/api/v2/12345/99999999999999999999/Form 3/Consent and Summary/document?id=" & RecordId()
Luison Lassala 3/1/2022 11:16:58 AM
@Scott - Genius!!! It worked first time! Amazing!!!

Thank you so much for looking into this so promptly!
Feedback
Back to Search Results