Change number of copies x++ when using print management

I have made a modification where I print a sales invoice via x++ code using to print SalesFormLetter.update. The customer invoice is setup in print management with the number of copies set to 1. This has worked fine up until now. I have a new requirement that I need to change the number of copies of the printed invoice based on the type of item being sold. In my process can I easily determine how many copies to produce, but how can I change the number of copies that will print be created by print management?

Shawn

I never used this functionality, but it seems to be supported out of the box.

You can define conditional settings in in print management setup, specify a query for the given case and set the number of copies. Refer to documentation for detailed steps: Set up print management for a module > Specify conditional settings for an original or copy record.

Martin,

Thank you for the reply. The link you provided doesn’t seem to work, but I was able to search using the text of the link and found a document. I believe this will do what I need it to do based on the description. I am having a problem with setting up the conditions for the document. I followed the instructions in the document, part of which are in italics below, but I never get to the point where Select is available to edit the query.

  1. Right-click an original or copy record and select New. A new conditional setting is created and is displayed in the list.

  2. In the right pane, enter a description for the setting, such as Customers 4000 to 4050.

  3. Click Select and enter the query condition that must be fulfilled in order to print the document by using the current settings. For example, you might select a range of customer accounts. Click OK to return to the Print management setup form.

I’m setup as a system administrator, so I don’t believe its a security issue. Has the functionality changed for D365F&O?

Shawn

Sorry about the link; I’ve fixed it now.

The setup works for me D365FO:

Make sure that you’re at the right level.

I see now. I was clicking new against the wrong menu item. I have it now against the correct location and I have a condition available. Thanks for all your help.

Shawn

Martin,

Although your solution worked for my stated requirements, the users have come back and said that there are too many queries for them to setup and want to have a modification where I add a field to the item table to store the number of copies to print. This puts me back to square one. Can you tell me how I can change the number of copies of a sales invoice that is printed using x+ and salesFormLetter_Invoice?

Shawn

I’m not sure what’s the best method there. I would try calling updatePrinterSettingsFormLetter(). Like this:

SRSPrintDestinationSettings printSettings = new SRSPrintDestinationSettings(this.printerSettingsFormletter(PrintSetupOriginalCopy::Original));
printSettings.numberOfCopies(2);
this.updatePrinterSettingsFormLetter(printSettings.pack(), PrintSetupOriginalCopy::Original);

It’s up to you to define conditions when it should be called.

By the way, if you make the setup on item, don’t forget that one invoice may include multiple orders, and each order may include multiple items.

Thank you very much Martin.