Roboteka
Roboteka · Robots · Get last document

Get last document

The Get last document robot returns, inside a Bitrix24 (Alaio) workflow, the last document generated from a template for a deal, lead, contact, company, quote, invoice or smart process item: title, number, template, date and DOCX and PDF links.

Stock robots can generate a document from a template, but they cannot find a document generated earlier, by a manager or by another process. This robot reads the documents of the item the process runs on and returns the most recent one. With a template ID it returns the last document of that template only, for example the last invoice rather than the last delivery note. The DOCX and PDF links open for an employee signed in to Bitrix24. The PDF link is empty until Bitrix24 has prepared the PDF. When there are no documents the robot returns "Document found = No" and the process can take another branch. With "Create a public link" switched on, the robot opens link access to the document and returns the link: it can be sent to a client by e-mail and opens without signing in to Bitrix24.

What input parameters does the robot accept?

Parameter Type Required? Default
Template ID (empty means any template) int —
Create a public link (opens without signing in to Bitrix24) bool — N

What does the robot return?

Parameter Type
Document found bool
Document ID int
Document title string
Document number string
Template ID int
Created at string
DOCX link string
PDF link string
Public link (opens without signing in) string
Success bool
Error string

What errors can the robot return?

The robot writes these messages to the business process log when it cannot complete a step. The text tells you what to fix in the settings or the data.

  • The robot works only in leads, deals, contacts, companies, quotes, invoices and smart processes.
  • API error while reading the item documents: {message}
  • Document #{id} was found, but the public link could not be created: {message}

Scenario: the last invoice number in a deal field

  1. A manager generates an invoice from a template in the deal card
  2. On the next stage the robot finds the last document of the invoice template
  3. The number and the PDF link are written to deal fields and sent to accounting in a notification

Related robots