D365F&O, Developer, Uncategorized

How to add a new document in Print Management setup in D365F&O – using X++

Print management is the framework that we use in Dynamics 365 Finance and Operations S to configure print settings for various business documents (SSRS Reports), including sending emails, archiving, saving as a file, printing automatically, or just displaying at the screen. Print management setups are typically separated by module and for each module, there are different nodes for all business documents that are available to be printed.

How to add new document in Print Management – WHS Module

Sometimes you need to create new business documents in Dynamics 365 F&O. So you need to add this business document/report in the Print management form setup.

To add this new document in Print Management you should follow those steps:

Step 1: Create an extension of PrintMgmtDocumentType base enum and add a new node that will represent your new document. (Ex. WHSRouteOverview)

Step 2: In our case, we should add our new document to the WHS module. Based on which module you should add your custom document, extend PrintMgmtNode class. I extended WhsPrintMgmtNode_WHS and I added the following code to add the custom document type.

/// <summary>/
/// Get Document type that we created
/// </summary>
final class WhsPrintMgmtNode_WHS_Extension
    public List getDocumentTypes()
        List docTypes;

        docTypes = new List(Types::Enum);

        docTypes = next getDocumentTypes();

        return docTypes;

Step 3: For this business document you should add a default report in the Printer Management setup. To add a default report we should subscribe to the NotifyPopulate method of PrintMgmtReportFormatPublisher class and add the following code.

/// <summary>/;
///  Insert a default report to custom document, subscribe to NotifyPopulate method of PrintMgmtReportFormatPublisher class.
/// </summary>
public final class PrintMgmtReportFormatPublisher_Extension
    /// <summary>/;
    ///  Insert a default report to custom document
    /// </summary>
                 delegatestr(PrintMgmtReportFormatPublisher, notifyPopulate))]
    public static void notifyPopulate()

        void addFormat(PrintMgmtDocumentType _type, PrintMgmtReportFormatName _name,
                   PrintMgmtReportFormatCountryRegionId _countryRegionId = #NoCountryRegionId)
           AddPrintMgmtReportFormat::addPrintMgmtReportFormat(_type, _name, _name,

                      ssrsReportStr(WHSRouteOverviewReport, Report));


Step 4: I have created another class AddPrintMgmtReportFormat where I added the static method to Add print management report format.

/// <summary>/;
/// Create a new addPrintMgmtReportFormat to use for changing report format
/// </summary>
public class WHSAddPrintMgmtReportFormat
    /// <summary>
    /// Add new report format in print management method
    /// </summary>
    /// <param name = "_type">PrintMgmtDocumentType</param>
    /// <param name = "_name">PrintMgmtReportFormatName</param>
    /// <param name = "_description">PrintMgmtReportFormatDescription</param>
    /// <param name = "_countryRegionId">PrintMgmtReportFormatCountryRegionId</param>
    /// <param name = "_system">PrintMgmtReportFormatSystem</param>
    /// <param name = "_ssrs">PrintMgmtSSRS</param>
    public static void addPrintMgmtReportFormat(
        PrintMgmtDocumentType _type,
        PrintMgmtReportFormatName _name,
        PrintMgmtReportFormatDescription _description,
        PrintMgmtReportFormatCountryRegionId _countryRegionId,
        PrintMgmtReportFormatSystem _system = false,
        PrintMgmtSSRS _ssrs = PrintMgmtSSRS::SSRS)
        PrintMgmtReportFormat printMgmtReportFormat;

        select firstonly printMgmtReportFormat
            where printMgmtReportFormat.DocumentType == _type
                && printMgmtReportFormat.Description == _description
                && printMgmtReportFormat.CountryRegionId == _countryRegionId;

        if (!printMgmtReportFormat)
            // Add the new format
            printMgmtReportFormat.DocumentType = _type;
            printMgmtReportFormat.Name = _name;
            printMgmtReportFormat.Description = _description;
            printMgmtReportFormat.CountryRegionId = _countryRegionId;
            printMgmtReportFormat.System = _system;
            printMgmtReportFormat.ssrs = _ssrs;

Step 5: To get the default report, subscribe to the delegate getDefaultReportFormatDelegate of class PrintMgmtDocType.

/// <summary>/;
/// Associate new print management document type with a default report design
/// </summary>
public static class PrintMgmtDocType_Extension
    [SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType,
    public static void getDefaultReportFormat(PrintMgmtDocumentType _docType, EventHandlerResult
        switch (_docType)
            case PrintMgmtDocumentType::WHSRouteOverview:


Step 6: Now you can configure the print setting for this document in the Print Management form setup. In our case, we should follow the path: Warehouse management > Setup > Warehouse management parameters. In the print management tab, we should click the print management button.

With right-click on our custom report name, we can create and configure a new print setup.

Maybe the print management form can be a little difficult to find if you don’t know where to look. The print management form is accessible in most cases from the “Form setup” form or as a tab directly on the module parameters form. For example, the print management form for the Sales module documents can be found in path: Accounts receivable > Setup > Forms > Form setup > Print management.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s