Print Management Settings in Dynamics AX Seem to Disappear or Reset after a Code Move

By Laura Lake | March 19, 2018

Print management settings in dynamics ax seem to disappear or reset after a code move

A client recently reported that their customer overrides for Print Management in Dynamics AX had suddenly all reset to Screen. They used Print Management extensively to email Invoices to their customers. Having these emails suddenly “wiped out” was a critical issue for them.

In discussing the issue, it came to my attention that a recent code promotion to Production had occurred. I found that the SrsPrintDestinationSettings class had been modified, and the packed version had been changed from 1 to 2 as in the example below.

Print Management Settings

If you have not had to dig into the details of Print Management before, you may not be aware that when the settings are overridden in Print Management, such as adding an email for a customer invoice, the values packed in this class are actually stored in the PrintMgmtSettings.PrintJobSettings field in a container – EDT PrintJobSettingsPacked.

When the class was moved to production with the new version (2), users could no longer see the values stored previously as version 1. Those values were still in the container in the PrintJobSettings field, but they could not be accessed using version 2.

Let me give an example. We have modified customer 100023 to override the Destination setting for invoices. This modification was done prior to the class change when the packed version was 1.

Print Management Setup

You can use code similar to this in order to see what was packed via debugger…

Define a macro using the list defined in SrsPrintDestinationSettings. You will need most of the variables defined there also.

#localmacro.oldList
        version,
        packedPrintMedium,
        printMediumType,
        printerName,
        printerPageSettings,
        landscape,
        printerStatus,
        printerType,
        printerWhere,
        printerComment,
        printAllPages,
        fromPage,
        toPage,
        numberOfCopies,
        emailTo,
        emailCc,
        emailSubject,
        emailAttachmentFileFormat,
        emailAttachmentImageFileFormat,
        fileName,
        fileFormat,
        imageFileFormat,
        overwriteFile,
        printToArchive,
        overridePageSettings,
        overwriteFileIsSet
    #endmacro

Write a select to find the record you are interested in…

    select DocumentType, Name, ReferencedRecId from printMgmtDocInstance
    join  custTable
    where custTable.RecId == printMgmtDocInstance.ReferencedRecId
        && printMgmtDocInstance.ReferencedTableId == tableNum(custTable)
        && (custTable.AccountNum == "100023") // specify customer account here, if needed
    join printMgmtSettings
        where printMgmtDocInstance.RecId == printMgmtSettings.ParentId;

    if (conPeek(printMgmtSettings.PrintJobSettings,1) == 1) //version 1

    {
        [#oldlist] = printMgmtSettings.PrintJobSettings;
    }

 

Print settings

Since these values were stored as version 1, they will not show up once the class has changed to version 2. Now we will see something like this…

Print settings

There are a couple of ways to handle the problem:

1.  Try to avoid modifying framework classes to begin with. I understand that sometimes we have to go against our better judgment to accommodate our clients.

2.  When you change the packed version in any class, consider whether you should add a switch statement in the class to pull the previous version’s values from the field (or usage data) if they exist. Most of the time it is probably unnecessary since users don’t expect their usage data to be permanent. However, as in this issue, those values may be stored in a table. The code would look something like this…

switch (version)
	{
		case #version1:
			[#version1List] = packedClass;
			break;
		case #version2:
			[#version2List] = packedClass;
			break;
	}

3.  My client opted for updating the version directly in the PrintJobSettings field from 1 to 2. In this way, the previously entered values will magically appear again.

Here is some sample code to illustrate the update. Literals were used for clarity.

while select DocumentType, Name, ReferencedRecId from printMgmtDocInstance
    join  custTable
    where custTable.RecId == printMgmtDocInstance.ReferencedRecId
        && printMgmtDocInstance.ReferencedTableId == tableNum(custTable)
        && (custTable.AccountNum == "100075") // specify customer account here, if needed
    join forupdate printMgmtSettings
        where printMgmtDocInstance.RecId == printMgmtSettings.ParentId
    {
        if (conPeek(printMgmtSettings.PrintJobSettings,1) == #version)
        {
            [version,#oldlist] = printMgmtSettings.PrintJobSettings;
            ttsBegin;
            printMgmtSettings.PrintJobSettings = [2,#oldlist,0];
            printMgmtSettings.update();
            ttsCommit;
        }
       
  
    }

Note: The zero in the version 2 container was added for a new variable in version 2. You could just retrieve the record and call update() without changing anything since it would be saved as version 2 by default.

TaDa!

Print settings disappear

If your Print Management Settings in Dynamics AX  Disappear or Reset after a Code Move, I hope these tips can help you.

Related Posts

Recommended Reading:

Manage U.S. Use Tax on Purchase Orders in Dynamics 365 Finance and Operations

  Managing sales tax requirements on your business purchase can be complicated, but Dynamics 365 Finance and Operations can help […]

Read the Article
5.19.22 Dynamics CRM

How to Write a Great Support Ticket in the Stoneridge Support Portal

Submitting a support ticket through the Stoneridge Support Portal is a quick and effective way to get assistance for any […]

Read the Article

Managing Your Business Through Uncertain Times Using Dynamics 365 Finance and Operations

  Dynamics 365 Finance and Operations (F&O) can help you make informed decisions on how to move your business forward. […]

Read the Article
5.13.22 Power Platform

Using Power BI Object Level Security

  The following article will demonstrate how to use Power BI Object Level Security to disable column data based on […]

Read the Article
5.12.22 Dynamics CRM

How to Use the Stoneridge Support Portal

Stoneridge Software’s support portal is an intuitive and useful function that makes it easy for you to access resources to […]

Read the Article
5.6.22 Dynamics GP

Dynamics GP Transaction Removal: Purchase Orders

  Are you having performance issues with Purchase Orders?  Do you find that there are old Purchase Orders on your […]

Read the Article
5.5.22 Dynamics GP

The Real Story about the Long-Term Future of Dynamics GP Support

I’ve seen a number of people put forward comment that Dynamics GP is going away and you have to get […]

Read the Article

New Features in Dynamics 365 Business Central 2022 Wave 1 Release – Financial Enhancements

The Dynamics 365 Businses Central 2022 Wave 1 Release has a lot of new and exciting features to help your […]

Read the Article
4.29.22 Dynamics GP

Dynamics GP Transaction Removals: Bank Reconciliation

  This is part 2 of a 3 part series on Dynamics GP Transaction Removals. These quick tips will hopefully […]

Read the Article

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X