web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Changing print parameters within AX 2009 changes users' default Windows printer

(0) ShareShare
ReportReport
Posted on by

This is a weird thing that just started happening when a user got a new computer. Whenever this user selects a different printer for labels within AX, it changes the Windows default printer for anyone who has access to the label printer. Yes, the Windows default printer, not the default printers within AX. Anyone have any ideas? I hope it's a Windows issue so I can fob it off on the network people...

*This post is locked for comments

I have the same question (0)
  • Ghetz Profile Picture
    3,013 on at

    Could you explain what do you exactly mean by:

    "Whenever this user selects a different printer for labels within AX,"

    Are you talking about standard print management, a particular report or any custom form you've developed fot this, etc? What's the user actually doing?

    Also it would help to know what's the exact environment, so we could try to reproduce this error:

    - AOS Server OS

    - client OS, etc.

    - Are the clients working with terminal server or standard network/domain.

    - Is it a print server or a printer shared by one machine.

    Personally, i've never seen this happen in a standard ax 2009 installation.

  • Community Member Profile Picture
    on at

    Everyone logs in locally. Almost everyone is on Windows 7. The AOS is 5.0.1500.4570. It is a network printer.

    When one specific user prints labels (aka, a "report"), he chooses the label printer by going to a custom form and selecting it there. Then, weirdly, this move switches all the other users' Windows default printer to the one the specific user selected. I am pretty sure it's a Windows error, not an AX problem, as it worked before the user got a new machine a few weeks ago, but I am baffled.

    This is custom code, but it was written years ago and we've never had any issues with it, and I really do not understand how changing a printer in AX could change an entire group of people's Windows default printer.

    Here's the code that actually changes the printer settings within AX. It's a method on a table.

    static void changePrinter()
    {
    PrintJobSettings printJobSettings = new PrintJobSettings();
    LabelPrintParameters labelPrintParameters = LabelPrintParameters::find();
    ;
    printJobSettings.setTarget(labelPrintParameters.PrinterTarget);
    printJobSettings.preferredTarget(labelPrintParameters.PrinterTarget);
    printJobSettings.deviceName(labelPrintParameters.LabelPrinter);

    if (printJobSettings.printerSettings('SysPrintForm'))
    {
    ttsbegin;
    if (labelPrintParameters)
    {
    labelPrintParameters.selectForUpdate(true);
    }

    labelPrintParameters.LabelPrinter = printJobSettings.printerPrinterName();
    labelPrintParameters.PrinterDriverName = printJobSettings.printerDriverName();
    labelPrintParameters.PrinterPortName = printJobSettings.printerPortName();
    labelPrintParameters.PrinterTarget = printJobSettings.getTarget();
    labelPrintParameters.PrinterRunOn = printJobSettings.printerRunOn();
    labelPrintParameters.write();
    ttscommit;
    }
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans