<?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 - Kodeqa</title>
	<atom:link href="https://kodeqa.com/tag/print-management/feed/" rel="self" type="application/rss+xml" />
	<link>https://kodeqa.com</link>
	<description>Official Website</description>
	<lastBuildDate>Thu, 04 Jul 2024 08:35:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://kodeqa.com/wp-content/uploads/2024/03/cropped-kodeqa-favicon-32x32.png</url>
	<title>print management - Kodeqa</title>
	<link>https://kodeqa.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to add a custom electronic reporting (ER) CBD report to print management</title>
		<link>https://kodeqa.com/how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management</link>
		
		<dc:creator><![CDATA[Kodeqa]]></dc:creator>
		<pubDate>Mon, 03 Jun 2024 20:05:47 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Electronic Reporting]]></category>
		<category><![CDATA[CBD]]></category>
		<category><![CDATA[D365FO]]></category>
		<category><![CDATA[electronic reporting]]></category>
		<category><![CDATA[print management]]></category>
		<guid isPermaLink="false">https://kodeqa.com/?p=1752</guid>

					<description><![CDATA[<p>In the standard D365FO print management form, we have a number of predefined document types which can be setup to print different reports, however it is not an uncommon requirement to create one or multiple custom electronic reporting CBD formats for a document which does not exist in print management. In this post we are [&#8230;]</p>
<p>The post <a href="https://kodeqa.com/how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management/">How to add a custom electronic reporting (ER) CBD report to print management</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></description>
			<style id="elementor-post-1752">.elementor-1752 .elementor-element.elementor-element-1f213231{--display:flex;}.elementor-1752 .elementor-element.elementor-element-1f213231.e-con{--flex-grow:0;--flex-shrink:0;}.elementor-widget-text-editor{font-family:var( --e-global-typography-text-font-family ), Sans-serif;font-size:var( --e-global-typography-text-font-size );font-weight:var( --e-global-typography-text-font-weight );color:var( --e-global-color-text );}.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:var( --e-global-color-primary );}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap, .elementor-widget-text-editor.elementor-drop-cap-view-default .elementor-drop-cap{color:var( --e-global-color-primary );border-color:var( --e-global-color-primary );}@media(min-width:768px){.elementor-1752 .elementor-element.elementor-element-1f213231{--width:100%;}}@media(max-width:1024px){.elementor-widget-text-editor{font-size:var( --e-global-typography-text-font-size );}}@media(max-width:767px){.elementor-widget-text-editor{font-size:var( --e-global-typography-text-font-size );}}</style>							<content:encoded><![CDATA[<div data-elementor-type="wp-post" data-elementor-id="1752" class="elementor elementor-1752">
				<div class="elementor-element elementor-element-1f213231 e-con-full e-flex e-con e-parent" data-id="1f213231" data-element_type="container" data-e-type="container">
				<div class="elementor-element elementor-element-47609cdb elementor-widget elementor-widget-text-editor" data-id="47609cdb" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									
<img fetchpriority="high" decoding="async" width="748" height="689" class="wp-image-1785 aligncenter" style="width: 600px; height: auto;" src="https://kodeqa.com/wp-content/uploads/2024/06/001_Intro-1.jpg" alt="" srcset="https://kodeqa.com/wp-content/uploads/2024/06/001_Intro-1.jpg 748w, https://kodeqa.com/wp-content/uploads/2024/06/001_Intro-1-300x276.jpg 300w" sizes="(max-width: 748px) 100vw, 748px" />

<p>In the standard D365FO print management form, we have a number of predefined document types which can be setup to print different reports, however it is not an uncommon requirement to create one or multiple custom electronic reporting CBD formats for a document which does not exist in print management.</p>
<p>In this post we are going to see how we can add a new document type to print management that we can use to configure and run custom CBD formats.</p>
<h6> </h6>
<h2>Adding a new document type</h2>
<p>Firstly, we are going to start off by adding our document type to the print management form of an existing or a custom module.</p>
<p>The steps we need to take are as follows:</p>
<ol>
<li>We extend the <strong>PrintMgmtDocumentType</strong> enum:
<ul>
<li>Add a new element with a relevant name for your report.<br /><img decoding="async" class="alignnone wp-image-1754" src="https://kodeqa.com/wp-content/uploads/2024/06/001_Screenshot-300x115.png" alt="PrintMgmtDocumentType" width="595" height="228" srcset="https://kodeqa.com/wp-content/uploads/2024/06/001_Screenshot-300x115.png 300w, https://kodeqa.com/wp-content/uploads/2024/06/001_Screenshot.png 551w" sizes="(max-width: 595px) 100vw, 595px" /></li>
<li>Create an extension of the <strong>PrintMgmtNode</strong> class specific to your module. If for example, we are working with a standard module, we are going to modify the <strong>WhsPrintMgmtNode_WHS</strong> class which applies to the Warehouse management module. Modify the <strong>getDocumentTypes</strong> method of the class and add our document type to this print management node. We can do this with the following code:</li>
<li> </li>
</ul>
</li>
</ol>

<pre class="wp-block-code"><code>public List getDocumentTypes()
{
    List docTypes = next getDocumentTypes();
    docTypes.addEnd(PrintMgmtDocumentType::CustomDocument);
    return docTypes;
}</code></pre>



<h2 class="wp-block-heading">Associate our CBD report with a document type</h2>



<p class="wp-block-paragraph">After finishing the above steps, we will be able to see our custom document type added to the specific module’s print management screen. However, we will still not able to see our custom CBD format in the <strong>Report</strong> <strong>format</strong> field in print management.<br /><br />To achieve this, our next step would be to extend the <strong>PrintMgmtReportFormatPopulator</strong> class, which will allow us to associate our custom CBD formats to our newly created document type. For this purpose, we can use the <strong>addOther </strong>method which takes 4 arguments:             </p>



<ul class="wp-block-list">
<li>PrintMgmtDocumentType enum &#8211; we send our newly added document type</li>



<li>CBD format name</li>



<li>CBD format description</li>



<li>CBD format country/region code</li>
</ul>



<pre class="wp-block-code"><code>[ExtensionOf(classStr(PrintMgmtReportFormatPopulator))]
final class PrintMgmtReportFormatPopulator_Extension
{ 
    protected void addDocuments()
    {
        this.addOther(PrintMgmtDocumentType::CustomDocument, 'Custom format name’, 'Custom format 
        description', 'Custom format country code');
 
        next addDocuments();
    }
}</code></pre>



<h2 class="wp-block-heading">Fetching our CBD format</h2>



<p class="wp-block-paragraph">Lastly, we need to get the CBD format which is selected for our document type in the print management setup.</p>



<pre class="wp-block-code"><code>public static ERFormatMappingId getFormatMapping()
{
    PrintMgmtDocInstance  printMgmtDocInstance;
    PrintMgmtReportFormat printMgmtReportFormat;
    PrintMgmtSettings     printMgmtSettings;
    ERFormatMappingTable  erFormatMappingTable;

    DataAreaId currentCompany = curExt();

    select firstonly RecId from printMgmtDocInstance
        where printMgmtDocInstance.DocumentType == PrintMgmtDocumentType::CustomDocument
            &amp;&amp; printMgmtDocInstance.PrintType == PrintMgmtDocInstanceType::Original
            &amp;&amp; printMgmtDocInstance.DataAreaId == currentCompany;

    select firstonly Name from printMgmtReportFormat
        where printMgmtReportFormat.DocumentType == PrintMgmtDocumentType::CustomDocument
            exists join printMgmtSettings
               	where printMgmtSettings.ReportFormat == printMgmtReportFormat.RecId
               	    &amp;&amp; printMgmtSettings.ParentId == printMgmtDocInstance.RecId
                    &amp;&amp; printMgmtSettings.DataAreaId == currentCompany;

    select firstonly RecId from erFormatMappingTable
        where erFormatMappingTable.Guid == 
            str2Guid(subStr(printMgmtReportFormat.Name, 21, strLen(printMgmtReportFormat.Name)-1));

    return erFormatMappingTable.RecId;
}
</code></pre>



<p class="wp-block-paragraph">The above method will return the format mapping object of the CBD format that is set up for our document type. The returned <strong>RecId </strong>can now be used with the following code to create a format mapping object:</p>



<pre class="wp-block-code"><code>ERObjectsFactory::createFormatMappingRunByFormatMappingId(formatMappingId);</code></pre>



<p class="wp-block-paragraph">These methods can be now used in your electronic reporting classes (service/controller/contract) to run the report.</p>



<h2 class="wp-block-heading">Final thoughts</h2>



<p class="wp-block-paragraph">After following the steps above steps, we have the framework setup to use a custom CBD with print management:</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="1415" height="748" class="wp-image-1762" style="width: 1064px; height: auto;" src="https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1.png" alt="" srcset="https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1.png 1415w, https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1-300x159.png 300w, https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1-1024x541.png 1024w, https://kodeqa.com/wp-content/uploads/2024/06/002_AddingACustomERToPrintManagement-1-768x406.png 768w" sizes="(max-width: 1415px) 100vw, 1415px" /></figure>



<p class="wp-block-paragraph">&nbsp;</p>

<p class="has-background" style="background-color: #f9f9d9;">In case we have a custom module where we want to add a new report to print management, we will have to extend the <strong>PrintMgmtNode</strong> class and implement its methods. This will be described in more details in a future post.</p>								</div>
				</div>
				</div>
				</div><p>The post <a href="https://kodeqa.com/how-to-add-a-custom-electronic-reporting-er-cbd-report-to-print-management/">How to add a custom electronic reporting (ER) CBD report to print management</a> first appeared on <a href="https://kodeqa.com">Kodeqa</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
