Document Distribution Routes
With document distribution routes, you can link entities to each other, ensuring that documents from one entity are automatically copied on to another (including template and extra fields).
When you copy the document from one entity to another, a new document is created (the copy) with some additional tags. These additional tags specify the particular entity where the copy was created. You can find this copy on both entities. In that way, the original document stays untouched on the primary entity.
For example: linking item to sales order
When you add an item to a sales order line, and that item has documents attached to it in Raptor, a copy of those documents are automatically added to the sales order (and to the item).
Setup in Business Central
1. 9A Raptor Document Distribution Setup
Set up the routes that specify from and to where documents will be copied.


From Entity: entity where you want to copy the documents from
To Entity: entity where you want to copy the documents to
Distribution Tags: this determines what documents you copy. Only documents with the file-tag that you specify here will be copied. It is important that you provide a distribution tag, otherwise the copying won't work.
These tags need to be created in Raptor (see Setup in Raptor: taxonomy > 1. File Tags)
Make sure to add these tags to your original document.
Action: Copy Selected Routes: you can copy the parameters (e.g. distribution tags) from this entity to another entity
2. Integration Scenarios
For entities that have 'lines' such as purchase order, sales invoice, etc. you need to create a line tag in order for it to work. In this way the copied document is provided with a tag about the line.

The Line Tag needs to be created in Raptor (see Setup in Raptor: taxonomy > 2. Line Tags)
When you don't set up a line tag, the following error will appear when trying to fill in the line.

Setup in Raptor: taxonomy
1. File Tags
Create FileType as a root tag in the taxonomy tree. Under this tag you can create the preferred child tags that you use on your document, such as drawing or contract.

2. Line Tags
Create Line Tags under your D365-BC root tag.

This is necessary for sales order lines and purchase order lines
Make sure to add a tag relation to the related order tag
Functionality
1. Document distribution: original and copies
When you copy the document from one entity to another, a new document is created (the copy) with some additional tags. You can find this copy on both entities.
Entity where you copy FROM:
On the entity where you copy from, you will have the original document and a copy when the document is used in another linked entity. All the available copies from different entities will appear here.
Original Document:

Copy:

The copy has the following tags to indicate that it is a copy of the original
CreatedBySystem
Extra information about the entity where it is copied to. In this example the document was copied to a sales order line
Sales order line - sales order - customer linked to that sales order
Entity where you copy TO:
On the entity where you copy to, you will only have the copy that is relevant to that order for example.
2. Original documents on 9A viewer
At first glance, it is not clear what document is the original document and what are the copies.
Because the copies of the document get the 'CreatedBySystem'-tag, you can filter the view to only show the original documents with the following query:

It is easier to save this query (step 3). For example under a name such as 'Original Documents'. That way, you can easily select the query and filter the documents
This filter is available for all 9A viewers, so you can use it on other entities as well
3. Example flow: item > sales order
Document distribution setup:
From item to sales order
Distribution tag = FileType\Drawing
1) Add a document to the item
On the item, add a document with the drawing distribution tag
2) Create a sales order with this item as a sales order line

When you send the sales order to raptor, two documents are made in this case:
1) The standard sales order document
2) A copy of the document from the item, with the following additional tags:
CreatedBySystem - sales order line - sales order - customer from the sales order
Last updated