<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>print management &#8211; Goshoom.NET Dev Blog</title>
	<atom:link href="https://dev.goshoom.net/tag/print-management/feed/" rel="self" type="application/rss+xml" />
	<link>https://dev.goshoom.net</link>
	<description>Martin &#34;Goshoom&#34; Dráb - Dynamics AX, .NET and Everything</description>
	<lastBuildDate>Thu, 16 Apr 2026 06:26:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.5</generator>
	<item>
		<title>Supporting conditions in print management</title>
		<link>https://dev.goshoom.net/2026/04/supporting-conditions-in-print-management/</link>
					<comments>https://dev.goshoom.net/2026/04/supporting-conditions-in-print-management/#respond</comments>
		
		<dc:creator><![CDATA[Martin Dráb]]></dc:creator>
		<pubDate>Thu, 16 Apr 2026 06:26:31 +0000</pubDate>
				<category><![CDATA[Dynamics Community Syndication]]></category>
		<category><![CDATA[EN]]></category>
		<category><![CDATA[D365FO]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[print management]]></category>
		<category><![CDATA[query]]></category>
		<guid isPermaLink="false">https://dev.goshoom.net/?p=10283</guid>

					<description><![CDATA[Print management in F&#38;O (as well as in Dynamics AX) allows you not just to select the report design, print destination etc., but also do it conditionally, e.g. you may want to use different designs or footer texts for certain customers. In print management setup, you must first define a default setup (which doesn&#8217;t allow ...</p><p><a href="https://dev.goshoom.net/2026/04/supporting-conditions-in-print-management/" class="more-link">Continue reading &#8216;Supporting conditions in print management&#8217; &#187;</a>]]></description>
										<content:encoded><![CDATA[
<p>Print management in F&amp;O (as well as in Dynamics AX) allows you not just to select the report design, print destination etc., but also do it conditionally, e.g. you may want to use different designs or footer texts for certain customers.</p>



<p>In print management setup, you must first define a default setup (which doesn&#8217;t allow conditions) and then you add more configurations below it with conditions.</p>



<figure class="wp-block-image size-medium"><a href="https://dev.goshoom.net/wp-content/uploads/2026/04/Print-management-h.png"><img fetchpriority="high" decoding="async" width="300" height="285" src="https://dev.goshoom.net/wp-content/uploads/2026/04/Print-management-h-300x285.png" alt="Print management setup form with the condition highlighted" class="wp-image-10285" srcset="https://dev.goshoom.net/wp-content/uploads/2026/04/Print-management-h-300x285.png 300w, https://dev.goshoom.net/wp-content/uploads/2026/04/Print-management-h.png 576w" sizes="(max-width: 300px) 100vw, 300px" /></a></figure>



<p>If you develop your own report that utilizes print management, you must tell the system which table to use for the condition. It&#8217;ll then create a query that you can modify by pressing the <em>Select</em> button, and you can add more data sources there by joining tables related to the main one.</p>



<p>There are a few variants of the solution, but the most straightforward is creating a CoC extension of <em>PrintMgmtDelegatesHandler.getQueryTableId()</em> and returning a table ID from there. For example:</p>





<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="xpp"><pre class="de1"><span class="br0">&#91;</span>ExtensionOf<span class="br0">&#40;</span><span class="kw3">classStr</span><span class="br0">&#40;</span>PrintMgmtDelegatesHandler<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#93;</span>
<span class="kw2">final</span> <span class="kw2">class</span> PrintMgmtDelegatesHandlerMy_Extension
<span class="br0">&#123;</span>
    <span class="co1">/// &lt;summary&gt;</span>
    <span class="co1">/// Retrieves the table that is used to define queries for the document type.</span>
    <span class="co1">/// &lt;/summary&gt;</span>
    <span class="co1">/// &lt;returns&gt;</span>
    <span class="co1">/// The table ID of the table this document type queries at runtime.</span>
    <span class="co1">/// &lt;/returns&gt;</span>
    <span class="kw2">protected</span> <span class="kw2">static</span> TableId getQueryTableId<span class="br0">&#40;</span>PrintMgmtDocumentType _docType<span class="br0">&#41;</span>
    <span class="br0">&#123;</span>
        TableId tableId <span class="sy0">=</span> <span class="kw4">next</span> getQueryTableId<span class="br0">&#40;</span>_docType<span class="br0">&#41;</span>;
&nbsp;
        <span class="kw2">switch</span> <span class="br0">&#40;</span>_docType<span class="br0">&#41;</span>
        <span class="br0">&#123;</span>
            <span class="kw2">case</span> PrintMgmtDocumentType<span class="sy0">::</span><span class="me2">MyReport</span><span class="sy0">:</span>
                tableId <span class="sy0">=</span> <span class="kw3">tableNum</span><span class="br0">&#40;</span>MyTable<span class="br0">&#41;</span>;
                <span class="kw2">break</span>;
        <span class="br0">&#125;</span>
&nbsp;
        <span class="kw2">return</span> tableId;
    <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>






<p>You may also want to select fields for default ranges that makes the best sense for the report. Again, you can extend a method of <em>PrintMgmtDelegatesHandler</em> class: <em>getQueryRangeFields()</em> in this case.</p>





<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="xpp"><pre class="de1"><span class="co1">/// &lt;summary&gt;</span>
<span class="co1">/// Retrieves the appropriate query range fields for the current document type.</span>
<span class="co1">/// &lt;/summary&gt;</span>
<span class="co1">/// &lt;returns&gt;</span>
<span class="co1">/// A list of &lt;c&gt;fieldnum&lt;/c&gt; fields for the appropriate query table that is based on the document type.</span>
<span class="co1">/// &lt;/returns&gt;</span>
<span class="co1">/// &lt;remarks&gt;</span>
<span class="co1">/// The &lt;c&gt;fieldnum&lt;/c&gt; fields are returned in the order they are intended to be displayed. They all</span>
<span class="co1">/// correspond to the table referenced by the &lt;c&gt;getQueryTableId&lt;/c&gt; method of the same instance of the</span>
<span class="co1">/// &lt;c&gt;PrintMgmtDocType&lt;/c&gt; class.</span>
<span class="co1">/// &lt;/remarks&gt;</span>
<span class="kw2">protected</span> <span class="kw2">static</span> List getQueryRangeFields<span class="br0">&#40;</span>PrintMgmtDocumentType _docType<span class="br0">&#41;</span>
<span class="br0">&#123;</span>
    List fields <span class="sy0">=</span> <span class="kw4">next</span> getQueryRangeFields<span class="br0">&#40;</span>_docType<span class="br0">&#41;</span>;
&nbsp;
    <span class="kw2">switch</span> <span class="br0">&#40;</span>_docType<span class="br0">&#41;</span>
    <span class="br0">&#123;</span>
        <span class="kw2">case</span> PrintMgmtDocumentType<span class="sy0">::</span><span class="me2">MyReport</span><span class="sy0">:</span>
            fields.<span class="me1">addEnd</span><span class="br0">&#40;</span><span class="kw3">fieldNum</span><span class="br0">&#40;</span>MyTable<span class="sy0">,</span> FieldA<span class="br0">&#41;</span><span class="br0">&#41;</span>;
			fields.<span class="me1">addEnd</span><span class="br0">&#40;</span><span class="kw3">fieldNum</span><span class="br0">&#40;</span>MyTable<span class="sy0">,</span> FieldB<span class="br0">&#41;</span><span class="br0">&#41;</span>;
            <span class="kw2">break</span>;
    <span class="br0">&#125;</span>
&nbsp;
    <span class="kw2">return</span> fields;
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>






<p>In the report controller, you need to provide a record for the conditions to be evaluated against. That&#8217;s the first argument of <em>PrintMgmtReportRun.load()</em> (or <em>loadPrintSettings()</em> if using <em>FormLetterReport</em>).</p>
]]></content:encoded>
					
					<wfw:commentRss>https://dev.goshoom.net/2026/04/supporting-conditions-in-print-management/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
