Tuesday, 23 July 2019

How to check if your customers received their invoices via email in D365FO

One way to check if your customers got your email with the invoice attached is to request a read receipt for the sent email message. While a delivery receipt confirms delivery of your email message to the recipient's mailbox, a read receipt confirms that the recipient opened the message.

Note: In Outlook, the message recipient can also decline to send read receipts.

In this article, I will explain how to set up and use Read receipt using the Docentric free tool. Please follow step by step process.

Step: 1

In Docentric report setup (Organization administration -> Docentric AX -> Reports) select the report for which you want to specify the additional parameters related to the emailing process. Click the Settings > Email sending settings button, which opens the Email sending settings form for the selected report.

Note:
For this article example I am using the SalesInvoice.Report.











Step: 2

In the Read and Delivery receipts, Message Priority tab you can configure few more per-report and per-company settings of email fields and parameters that are not available on the Print destination settings form.

Here we can configure Read receipt address by specifying the email address at which you want to get the read receipts when emailing the report. If you leave this field empty, then no receipt will be requested from email recipients. You can enter a valid email address or the @FROM_ADDRESS@ placeholder, in which case a read receipt will be sent to the sender of the email.














That is all you need to set up in order to start receiving read receipts at your configured email address for invoices that reach their email recipients.


Now let’s email the Customer invoice report and check how the whole process looks like. Assume that Print management is configured to email invoices. Open Invoice journal and click Use print management.









When an email with the attached invoice is received, and the recipient tries to open it and read it, an Outlook’s message pops up to ask should a read receipt be sent. If the recipient clicks Yes, an automatic email will be sent to Read receipt address – in my case Tabshir@live.com that I have set up above in the Docentric report setup > Email sending settings form.



























Monday, 24 June 2019

Printing Invoices to Attachments of Sales order, Journal or Customer in D365FO

If you print the Sales invoice report to the built-in File print destination, you cannot get much except for downloading the output report in the browser. Consequently, you cannot use this print destination in batch either. We had the requirement from our client to email invoices but also to save them to Attachments of the related sales order, all that performed in batch during the posting. We managed to achieve this scenario using the Docentric free-edition tool that offers printing reports to Attachments (also in batch) OOTB.

In this article I will explain how to print Sales invoice to Attachments of the related sales order, customer or journal using Docentric File print destination. Everything else (emailing invoices + saving them to Attachments) can be done via built-in Print management setup.

Note: Navigation for printing Sales invoices (Accounts receivable -> Inquiries and reports -> Invoices -> Invoice journal).

Let us see step by step process:

Step: 1

We need to set up Print management setup to point to Docentric File print destination for customer invoice (Accounts receivable -> Setup -> Forms -> Form setup -> General (tab) -> Print management (option)).













Step: 2


In “Output filename and format” section we need to set Output format to PDF also I am going to set filename.

Note: Docentric tool provides the possibility of using placeholders such as @InvoiceId@ or @InvoiceAccount@ in the output filename. Moreover, you can use report specific placeholders in all print destination settings including email body, subject, SharePoint target folder, etc.























Step: 3


In the final step, in Save to Attachments section do the following settings.
  1. Save to attachments checkbox should be set to Yes.
  2. Select File as Document type.
  3. Select Source table as Record type.























That is all it takes to setup printing Invoices to Attachments of the corresponding sales order.

If you want to attach invoices to the corresponding journal or customer records, you should select Journal or Account table as Record type on the Print destination settings form.

Now let’s run the customer invoice report. For this example, I am going to print the invoice (CIV-000233) for the sales order (0002340).







After running the report, attachment will be saved at sales order end, you can see it in below image.

Final result:



Tuesday, 28 May 2019

Edit emails with printed reports before sending them out from Dynamics 365 for Finance and Operations

Sometimes there is a need to check how an automatically generated email, e.g. with printed quotations or purchase orders looks like before we send it out from our Dynamics 365 for Finance and Operations. In my previous article you can learn how to preview such emails before sending using the Docentric free-edition tool. However, sometimes there is also a need to change something in the email body, for example, adding some additional attachments or email recipients to the generated emails. Luckily, you can do this very easily with the help of the same tool.

Let’s demonstrate this on the example of emailing the Customer account statement report (Accounts receivable -> Inquiries and reports -> Customers -> Customer account statement).

For this example, in the report dialog, I have selected one customer for which I want to print the report and I have changed the target print destination to Docentric Email.












In order to edit email with the attached report, we need to enable the "Open email before sending" option in the Print destination settings form. With this option turned on, instead of sending, the email will be downloaded so you can change the body, subject, and recipients or add additional attachments directly in your MS Outlook, before sending it manually.

Note: Above option is only applicable when not running in batch.























Now run the report, it will create and download the email as you can see in the image below.















Now we are going to add some additional information in the email which are as follows:

  1. Add a BCC email.
  2. Add an additional attachment, e.g. TermsAndConditions.pdf.
  3. Add a disclaimer to the email body.













That is all you need to do. Now you can simply send the email manually with changes.

Tuesday, 9 April 2019

Job to get contact person name and contact number of purchase order delivery address

In this blog, I will discuss how we can get the contact person name and contact number of purchase order delivery address located in the line details tab of PurchTable form.

Source Code:









public static void main(Args _args)
    {
        LogisticsElectronicAddress  electronicAddress;
        PurchTable                  purchTable;
        LogisticsLocation           logisticsLocation, logisticsLocationParent;

        purchTable = PurchTable::find("PurchaseOrderId");
        logisticsLocationParent = LogisticsLocation::find(purchTable.deliveryAddress().Location);

        select ParentLocation, RecId from logisticsLocation where
                logisticsLocation.ParentLocation == logisticsLocationParent.RecId;

        electronicAddress = LogisticsElectronicAddress::findByLocationAndType(logisticsLocation.RecId, LogisticsElectronicAddressMethodType::Phone);

        info(strFmt("Contact number: %1", electronicAddress.Locator));
        info(strFmt("Contact Person : %1", electronicAddress.Description));
    }

Monday, 1 April 2019

Automatically redirect printing of invoices from Email to Printer if customer contact email address is missing

We usually want to deliver invoices to our customers via email. However, if a customer doesn’t have a contact with the email address in D365FO, emailing of the invoice will fail. It would make sense to have such invoices printed to a printer instead so that we can send them by postal mail. Using a free add-on for D365FO called Docentric, this can be automated with just a few clicks. In this article, I will show you how we can set up and use this functionality with Docentric.

In order to email an invoice to a customer primary email contact, we need to use the @@ email token. We can also use any other purpose token, for example  @Invoice@.














So, when such a token cannot be resolved since a customer doesn’t have any contacts with email addresses, emailing of an invoice for such customer will fail. Instead of failing, Docentric will enable us to redirect execution of this report to a new preconfigured print destination, for example to a particular printer.


Let’s say a customer has the primary contacts.  So, each time when an invoice is emailed to the primary contact (@@ Email token in Email To field) using Print management, the emails with the attached invoice document will be sent to the corresponding customer contacts as shown in the images below.






Now, what if a customer has no primary contact? As you can see in the image below, resolving this email token results in warning, and no email will be sent.



This built-in behavior can be changed if you are using Docentric AX Free Edition so in case the customer contact email address is missing we automatically redirect printing of invoices from Email to Printer. Please follow step by step process to configure an alternative print destination.


Step: 1
For printing customer invoice report we need to register SalesInvoice.Report in Docentric report setup (Organization administration -> Docentric AX -> Reports) to use Docentric AX functionalities.

Note: For detailed understanding and how to register reports in Docentric report setup you can refer this How to Set Up Reports article.












Step: 2

In Docentric report setup click the Settings > Email sending settings button, which opens the Email sending settings form, where you can see the Email tokens tab. This fast tab offers the possibility to specify how to deal with unresolved Email tokens in Email To, Cc and Bcc fields if the Docentric Email print destination is used for printing a report.












The Email tokens fast tab contains a grid where you can specify per-company the following:

  • What should happen if tokens in Email To field were not resolved (Redirect To & Redirect If fields in the image below)? You can specify various options for redirecting. (In our case I am going to redirect email to the printer if tokens are not resolved)
  • Should the warning messages be displayed (Show warning message field below) if Email tokens in Email To, Cc and Bcc fields were not resolved?

In this Email token feature of Docentric following settings are available:
  • Company Id: If no record for the current legal entity exists, you will get the standard D365FO behavior.
  • Redirect to button: opens the Print destination settings form for the selected record, where you can modify the Redirect to print destination.
  • Redirect if: specifies the condition under which the print destination redirection should happen. You have the following possibilities:
    • Never: if you don’t want to redirect your report but you still want to be informed about the unresolved tokens you can use this option.
    • To field is empty due to unresolved tokens: this is the most important option which prevents the situation where the report is not sent, and you even don’t know about it.
    • Primary contact token is unresolved: redirect if the primary contact token (@@) is used in the Email To field and is not resolved.
    • No Purpose token is resolved: redirect if Purpose tokens (such as @Invoice@, @Business@ or similar) are used in the Email To field and none of them is resolved.
    • No token is resolved: combination of the above two settings. This option is useful if you want to have control of your data quality.
    • At least one token is unresolved: similar as above, your Email might be sent but miss an important recipient, so this option helps improve your data quality.
  • Show redirection message: if checked, the information about the redirection will be printed.
  • Show warning message: if checked, the Warning about the redirection will be printed.
That is all you need to setup the email which automatically redirects printing of invoices from Email to printer if customer contact email address is missing. After running the customer invoice report in the below image you can see the result which is redirecting the email to printer in case of email tokens failure.









Email token feature is very useful in cases when you are printing hundreds of Invoices to the Email print destination. Without it, in case of the unresolved tokens you would only get the message
"Error while executing report", without any other information about the Invoice document being printed or the Customer missing the contact information. You will have a really hard time identifying the unsent invoices. Even if the Email To field isn’t empty and the report is emailed, but some of the tokens were unresolved, you would want to be able to identify such parties missing the necessary contact information, so that you can improve your data quality and to know that the email didn’t reach some important destination.

For further email token settings and detailed understanding, you can refer to Email Token (Docentric) article.

Monday, 25 March 2019

Resolve TFS work item check-in error in D365FO

Recently I have got this error (one or more checked work item failed...) while check-in my source code on TFS but after a little struggle, I have got it fixed.

Please see below images:

Error:


Resolution: (Simply mark it as "associate" instead of "resolve.")


Result:

Job to insert a record of RetailSalesTable using X++ code in D365FO

In this blog, I will discuss how to insert a record of RetailSalesTable using X++ code.

    public static void main(Args _args)
    {
        SalesTable              salesTable;
        RetailSalesTable        retailSalesTable;
        OMInternalOrganization  internalOrganization;

        salesTable = SalesTable::find("SalesOrderNumber");

        select firstonly Name, RecId from internalOrganization
            where internalOrganization.Name == RetailChannelTable::findByRecId(salesTable.RetailChannelTable).name();

        ttsbegin;
        retailSalesTable.RetailChannel = salesTable.RetailChannelTable;
        retailSalesTable.OMInternalOrganization = internalOrganization.RecId;
        salesTable.packRetailSalesTable(retailSalesTable);
        retailSalesTable.insert();
        ttscommit;
    }













That is all.

Monday, 11 March 2019

Preview reports before printing in Dynamics 365 for Finance and Operations

When we want to email a report or to send it to a printer, it would be nice to have a chance to preview it first. I already blogged about the Docentric free-edition tool, which enabled me to customize the email body and add additional email attachments when emailing invoices. The same free add-on for D365FO will also enable us to preview reports before printing.

Let’s demonstrate this on the example of emailing the Customer account statement report (Accounts receivable -> Inquiries and reports -> Customers -> Customer account statement).

Preview before Emailing Reports:

For this example, in the report dialog I have selected one customer for which I want to print the report and I have changed the target print destination to Docentric Email.














In order to preview the report before emailing it, we need to enable "Preview before print" option in the Print destination settings form:


























Now run the report. Preview of the report will appear in the Docentric report viewer.














You have noticed that there are three options available for the user in the Docentric report viewer.
  • Continue printing to Email: It will continue the emailing process.
  • Cancel printing: It will cancel emailing of the report if the user is not satisfied with the preview.
  • Download Email: It will download an email message so that you can open it in your email client and check how it looks like. It is particularly interesting to see how the dynamic content was resolved, for example, email tokens or email additional attachments look.










Preview before Printing Reports:

For previewing the report before printing, we need to set the same "Preview before printing" option as we did in the above section, but this time we need to set this option in Printer Section of the Docentric print destinations settings.




































Now run the report. Preview of the report will be opened in the Docentric report viewer.














You have noticed that there are two options available in Docentric report viewer for Preview before print which will have the same functionality as discussed above.

That is all you need to do to enable this exciting free add-on feature for D365FO which will be very useful in cases when we need to verify or want to preview reports before emailing and printing.

Friday, 22 February 2019

Job to get distinct display product number in D365FO

In this blog I will discuss how to get distinct display product number in Dynamics 365 Finance and Operations. Please see below screenshot with source code explanation.

Note: In my case I have get Item Id and Invent Dim Id from RFQ Lines.

Explanation of source code (1.1):
  • Get purchase request for quotation from RFQCaseId and LineNum.
  • Updating inventory dimensions.
  • Find or Create inventory dimension.
  • Find inventory dimension combination is order to get product variant record Id.
  • Get display product number and set in info method.




Thursday, 21 February 2019

How users can print reports to their default printer in Dynamics 365 for Finance and Operations

End-users often demand to print reports to their default printer in Dynamics 365 for Finance and Operations. Unfortunately, there is no such functionality in standard D365FO. If you take a look at Print destination settings, there is no option available to set up the default printer.
























In this article I will show you how to set up your default printer in D365FO and then print reports using this setup. The prerequisite is to install a free add-on for D365FO called
Docentric, which provides many improvements regarding report print destinations, including Printing to default printer.

Let’s say that you want to print a Sales invoice report (Accounts receivable -> Inquiries and reports -> Invoices -> Invoice journal) to your default printer.








In order to do so, we need to configure the Docentric default printer in Print management settings for the Sales invoice report. Go to (Accounts receivable -> Setup -> Forms -> Form setup -> General (Tab) -> Click Print management). Select the Customer invoice report, click the arrow next to the Destination field and select Printer setup:





















This will open the Print destination settings form. Click Show Docentric destinations:
























Select default printer (@DEFAULT_PRINTER@) option in Printer print destination: 
























After accepting the selection, the resulting Print management setup form will look like this: 



















After the above described set up, when I run the Sales invoice report, it is printed to my default printer as shown in the image below. (In my case I am using PDFCreator as my default printer)









Now let’s see how to enable users to set up their own default printers and achieve the above result. Open the Docentric parameters form (Organization administration -> Docentric AX -> Docentric AX parameters), select the Security tab page and in the Default printer field group set Allow users to set up default printer.












Docentric free add-on provides each user the possibility to check his or her default printer by opening the User options form > Account tab > Default printer selection fast tab. If the above explained Allow users to set up default printer setting is enabled, user can set up his or her default printer by clicking the Change my default printer link.









This will open the User’s printer settings form where only the record for the current user is displayed and the Default printer value can be modified.










Administrator account also has the rights to configure the default printers for users and user groups, from the Printer print destination fast tab in Docentric AX Parameter form. You can find these options in the below image. Once you select the default printer value, it will enable the above described functionality for the selected users or user groups. 














That is all you need to do to start using the default printer functionality provided by the Docentric Free-Edition tool.

How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...