Report Attachments

One of many improvements that Docentric Email print destination offers is the possibility to specify additional attachments, which should be attached to the email message along with the report itself.

Learn about Reporting Emailing Capabilities when using Docentric >>

Docentric extended Attachments with the following settings: Language, Category, Tags, Active period, and Is Global attachment. Please note that you can use these settings in your custom scenarios as well.

Currently, Docentric uses these settings (Language, Category, Tags, etc.) for configuration of additional email attachments via Additional attachment rules on the Print destination settings form. You can also configure these Attachment settings when saving reports to Attachments via Docentric File print destination.

Furthermore, in one of the next releases, the same Attachment settings and similar Attachment rules will be used for configuring additional Attachments for the print destinations other than Email as well as for embedding or merging Attachments with the resulting report.

Docentric settings on the Attachments form

The Docentric settings fast tab is added to the standard D365FO Attachments form for Document management:

 

It contains the following fields:

  • Language: allows to refine the list of documents to be attached to the report, by matching the report runtime language with the language specified on the document.
  • Category ID: enables a simple way of categorizing the documents and specifying a rule for attaching all the documents marked with a given category. See Attachment categories.
  • Tags: provided only for user convenience, to make it easier to describe the document purpose and to identify it later, e.g. when selecting Global attachments.
  • Active period (Active from, Active to): enables to specify the period when the attachment is active.
  • Global attachment: visible and applicable only on the Attachments form for legal entities; see the left image above. If the attachment source is Global attachment, then only the current legal entity’s attachments with this option turned on are candidates for report attachments. For other types of the attachment sources this flag isn’t applicable.

The Docentric settings form

Notice a new menu item Global attachments (left image above) / Docentric settings (right image above) on the Attachments form. It opens a form which lists all the attachments in a tabular way, more convenient for editing. Below is the form that you can open from Attachments of the Customers form.

On the Global attachments/Docentric settings form only the last two columns (Original file name and File type) are read-only. Everything else can be edited, which provides a convenient way for maintaining the important attachment metadata used for the selection of the attachments in runtime.

Note that if the same form is opened from Attachments of a legal entity, only Global attachments will be displayed.

Attachment categories

Attachment categories introduced on the Attachments form are maintained through the separate Attachment categories form that you can open from the Docentric AX workspace.

 

Global attachments

From the Docentric AX workspace click the Global attachments menu item. It opens the Global attachments form:

 

Global attachments form provides a convenient summary overview of Global attachments per legal entity. For each of legal entities, we can see the following information in the grid:

  • Number of attachments: represents the total number of attachments, both Global and Non-Global, attached to a legal entity. Equals to the number shown by the paperclip in the top right corner of the form.
  • Number of Global attachments: shows the number of Global attachments (documents with the Global flag turned ON) per legal entity.
  • No. per language: provides a list of all languages used on the documents with the number of documents per language.
  • No. per category: gives a list of all categories used on the documents with the number of documents per category.

Notice the Global attachments menu item. It opens the form where you can view and edit all the information relevant to the report attachments (e.g. Description, Category or Language). You can also open the same form directly from Attachments on the Legal entities form.

Additional attachments sources

Report attachments are in runtime loaded from the documents stored under the D365FO Document management. There are several different record types from which we can load the attachments:

  • Global attachments: documents attached to legal entities, having the Global flag set, are candidates for report attachments. Examples are your company legal documents like T&C. Read more about the Global attachments setup >>
  • Source table: documents attached to the report source table. Report source table is report specific and not always applicable. For example, several reports on sales side (Sales order confirmation, Sales invoice, Sales packing slip) have the Sales order as a source. On purchasing side, Purchase order is often the related source table. Number of workers report is one example where source table is not applicable.
  • Source table lines: documents attached to the report source lines (e.g. Sales order lines, Purchase order lines, etc.)
  • Account table: documents attached to the related Customer table (for customer-facing reports) or the Vendor table (for vendor-facing reports). Not applicable to all reports.
  • Journal: documents attached to the related journal, if applicable. For example, when printing the Customer invoice report, it will be Invoice journal; for the Purchase order report it will be Purchase confirmation journal, etc.
  • Journal lines: documents attached to the journal lines (i.e. posted transactions).
  • Items: documents attached to the items on the journal lines where applicable.
  • Item variants: documents attached to released item variants where applicable. Variants of the items on the journal lines are considered.
  • Context record: represents the underlying entity (record) that the report is invoked from. Usually, it will be equal to Journal or Source table. The documents attached to this record are candidates for report attachments.
  • Custom record: requires custom implementation in the resolveReportAttachmentRecord() method of the related DSP class. For example, in this method you can return a Customer record specified as Order account on the related sales order.
  • Custom records: requires custom implementation in the resolveReportAttachmentRecord() method of the related DSP class. Unlike Custom record, by using Custom records you can specify more than one table record to be source for additional attachments. For example, in this method you can return products related to purchase order lines.

Notice that Global attachments are known already in the moment when you specify the rules for their retrieval (see Additional attachment rules), while all the other attachment source types require resolving their underlying record in runtime and retrieving the documents attached to that record. For that reason, we refer to them as Dynamic attachments.

Additional attachment rules

Which attachments should be emailed as additional attachments when emailing a report is specified directly on the Print destination settings form. What we need to do is to configure Additional attachment rules. Each rule defines the attachment source, optionally some filtering to be applied to a set of retrieved attachments, and few more parameters.

To configure Additional attachment rules, on the Docentric Email print destination open the Additional attachment rules fast tab. In the title, you will see the number of already specified rules:

Click the Modify button to open a dialog for specifying additional attachment rules:

Rule parameters

You can configure the following rule parameters here:

  • Load from: specifies the attachment source as explained in Additional attachment sources.
  • Category ID: from all the documents found on the specified source, take only those with the given Category ID. If no Category ID is specified, don’t apply filtering by category.
  • Attachment description: if provided, take only the documents with the matching description (The Description field on the Attachments form).
    • If source is Global attachments, then this is a lookup into a list of all available global attachments for the current legal entity and the DAT legal entity. Lookup is filtered to display only the documents for the current legal entity, but the filter can be removed to display also the DAT documents.
    • For any other source, this is a free editable text field, where you can specify the full attachment description (for example: "Item specification"), or only the partial description by using the wildcards * and ? (for example: "Item*", "*spec*", "?tem*", would all result in attachment with the description "Item specification" to be retrieved). You can also use the report placeholders; a list of applicable placeholders for the current report is available under the menu item Insert placeholder. For example, "@InvoiceAccount@*" on the Sales invoice report for the US-001 customer will return the documents where the description starts with US-001.
  • File type: if provided, take only the documents with the matching extension (for example: pdf, docx, png, etc.)
  • Restriction: retrieve only the documents with the corresponding restriction (External or Internal). Leave Both internal and external if you don’t want to filter by the restriction field.
  • Language: if you are dealing with documents in different languages, then you can use additional filtering by the language specified on the document. There are following possibilities:
    • Any language: choose this if you don’t want to apply any filtering by language.
    • Only the matching language: select only the documents where the same language as the report runtime language is specified.
    • The matching language, if not found then without language: try to find the documents with the same language as the report runtime language. Only if no such document is found, search for the documents without the language.
    • Both the matching language and without language: self-explanatory, use the documents with the same language as the report runtime language and the documents without the specified language.
  • Tags: if provided, take only the documents that contain all the specified tags. You can separate the tags by comma or semicolon.
  • If not found: select which action should be taken if no document was retrieved based on the given rule. You can cancel printing (and raise exception), or continue anyway, with or without the warning.
  • Display name: specify the filename (without the file extension) which should be given to the retrieved document(s) that are going to be attached to the outgoing email. You can use placeholders; particularly useful are the first two placeholders from the Insert placeholder dropdown: @ORIGINAL_DESCRIPTION@ that stands for the Description field of the original document and @ORIGINAL_FILENAME@ that stands for the File name field of the original document. For example, "@ORIGINAL_DESCRIPTION@ - @InvoiceAccount@" for the Sales invoice report for the US-001 customer and the document with Description "Quotation" will result in the following attachment name: "Quotation – US-001".
  • Resulting attachment name: the read-only result of Display name and File type representing the final filename (with the file extension) of additional attachment(s) of the outgoing email.
Notice that one rule can result in zero, one or more retrieved documents. If the same document would be retrieved based on two or more different rules, it would be attached only once to the email message.

Rule order

You can specify the order in which the rules will be processed in runtime by using the Up and Down buttons:

The first rule will be processed first, and all the documents retrieved based on this rule will be attached to the email message. Then the second rule is processed in a similar way and so on.

If any of the specified rules results in zero documents retrieved, and it has If not found = Cancel printing, the error will be raised, and the email will not be sent.

Placeholders

You can use the placeholders for Dynamic (Non-Global) attachments in the Attachment description, Display name and Tags fields. You can type in a placeholder in the position where you need it, or you can use the Insert placeholder button. The selected placeholder will be added to the end of the currently active field. Notice the first two placeholders in the right image below, they appear if the placeholder dropdown form is invoked from the Display name field.

 

@ORIGINAL_DESCRIPTION@ stands for Description of an attachment in the Attachments form, and @ORIGINAL_FILENAME@ stands for its File name.

Emailing examples

Example 1: Load T&C from Global attachments

Global attachments:

Rule:

Result:

Example 2: Load from Global attachments, filter by Category

Global attachments:

Rule:

Result:

Example 3: Load all attachments from Sales table

Attachments on the related Sales table:

Rule:

Result:

Example 4: Language configuration

Here is one possible way to utilize the Language parameter: you can have the Terms & Conditions document in French, Spanish and English language as 3 different attachments on your legal entity. You can specify French and Spanish language on the first two documents respectively, while you leave the English document without the language.

Global attachments:

Rule:
When you configure the rule for loading from the Global attachments, you specify the Language condition as The matching language, if not found then without language.

Result:
If the report runtime language is French or Spanish, the French or the Spanish document respectively will be attached. For all the other languages (including English), the English document will be attached.

You can introduce the Terms & Conditions category, assign all the relevant documents to that category and don’t worry about the attachment description. Instead, specify the Category ID in the rule and you will get the same result.

Reference: Load from > Resolved table for commonly used reports

Sales Invoice

Load from Resolved table Resolved table technical name Pro-forma supported
Source table Sales orders SalesTable Yes
Source table lines Order lines SalesLine Not in case of multiple Sales orders
Journal Customer invoice journal CustInvoiceJour No
Journal lines Customer invoice lines CustInvoiceTrans No
Items Items on journal lines InventTable No
Context record Same as source table No

Free text invoice

Load from Resolved table Resolved table technical name Pro-forma supported
Source table Customer free text invoice CustInvoiceTable Yes
Source table lines Customer free text invoice lines CustInvoiceLine Yes
Journal Customer invoice journal CustInvoiceJour No
Journal lines Customer invoice lines CustInvoiceTrans No
Items Items on journal lines InventTable No
Context record Same as source table No

Sales order confirmation

Load from Resolved table Resolved table technical name Pro-forma supported
Source table Sales orders SalesTable Yes
Source table lines Order lines SalesLine Yes
Journal Sales order confirmations CustConfirmJour No
Journal lines Confirmation lines CustConfirmTrans No
Items Items on journal lines InventTable No
Context record Same as source table No

Sales quotation

Load from Resolved table Resolved table technical name Pro-forma supported
Source table Sales quotation SalesQuotationTable Yes
Source table lines Quotation lines SalesQuotationLine Yes
Journal Quotation journal CustQuotationJour No
Journal lines Quotation lines CustQuotationTrans No
Items Items on journal lines InventTable No
Context record Same as source table No

RFQ

Load from Resolved table Resolved table technical name Pro-forma supported
Source table Request for quotation cases PurchRFQCaseTable Yes
Source table lines Request for quotation case lines PurchRFQCaseLine Yes
Journal Request for quotation journal VendRFQJour No
Journal lines Vendor – request for quotation lines VendRFQTrans No
Items Items on journal lines Items on journal lines No
Context record Same as source table Same as journal No

Purchase order

Load from Resolved table Resolved table technical name Pro-forma supported
Source table Purchase orders PurchTable Yes
Source lines Purchase order lines PurchLine Yes
Journal Purchase order confirmations VendPurchOrderJour No
Journal lines Purchase lines history PurchLineHistory No
Items Items on journal lines InventTable No
Context record Same as source table No

Project invoice

Load from Resolved table Resolved table technical name Pro-forma supported
Source table Invoice proposal ProjProposalJour Yes
Source table lines Invoice proposal lines (Expense, Item, Hour, Fee) ProjProposalCost
ProjProposalItem
ProjProposalEmpl
ProjProposalRevenue
Yes
Journal Project invoice ProjInvoiceJour Yes
Journal lines Project invoice lines (Expense, Item, Hour, Fee) ProjInvoiceCost
ProjInvoiceItem
ProjInvoiceEmpl
ProjInvoiceRevenue
Yes
Items N/A N/A N/A
Context record Invoice proposal ProjProposalJour Yes

See also

Report Emailing Capabilities >>
Report Email Sending Settings >>
Email Customer Invoice with Additional Attachments >>
Email Purchase Order with Additional Attachments >>
Video: Configure Item Attachments as Additional Email Attachments >>

IN THIS ARTICLE