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 :
Supply chain | Supply Chain Management, Commerce
Unanswered

Issue while Implementing Printmanagement setup for new custom report in D365fo

(0) ShareShare
ReportReport
Posted on by 555

Hi All,

I have a requirement in D365 FO  to implement a new Custom report on Transfer orders with Print management setup for that . I have followed below steps but facing the issue when the code hits formletterreport.Loadprintsetting() in controller class.

Please suggest if any code changes are required.

Created new Enum elements 

Base Enums\PrintMgmtNodeType-> TransferOrderInvoice

Base Enums\PrintMgmtDocumentType -> TransferOrderInvoice

Updated code in below classes

Classes\PrintMgmtHierarchy_Invent_Extension -> getNodesImplementation()

,getParentImplementation() 

Created a new class as below and added 4 methods as required

[PrintMgmtDocumentTypeFactoryAttribute(PrintMgmtDocumentType::TransferOrderInvoice)]
class InventFormLetterReport_TransferOrderInvoice extends FormLetterReport  

Created a new class to implement  delegate methods for Class -> PrintMgmtDocType methods -> getDefaultReportFormatDelegate(),getQueryRangeFieldsDelegate(),getQueryTableIdDelegate()

Created new class and added below code

[SubscribesTo(classStr(PrintMgmtDelegates), delegateStr(PrintMgmtDelegates, constructPrintMgmtNodeDelegate))]
public static void PrintMgmtDelegates_constructPrintMgmtNodeDelegate(PrintMgmtNodeType _nodeType, EventHandlerResult _result)
{
switch(_nodeType)
{
case PrintMgmtNodeType::TransferOrderInvoice :
_result.result(new PrintMgmtNode_TransferOrderInvoice());
break;
}
}

Created a new class and written code to populate report designs

class PrintMgmtReportFormatPublisherHelper
{

/// <summary>
///
/// </summary>
[SubscribesTo(classStr(PrintMgmtReportFormatPublisher), delegateStr(PrintMgmtReportFormatPublisher, notifyPopulate))]
public static void PrintMgmtReportFormatPublisher_notifyPopulate()
{

//code

}

Created a new controller class with below method 

protected void runPrintMgmt()
{


formLetterReport.loadPrintSettings(mytablebuffer,  -> here facing the issue 
mytablebuffer,CompanyInfo::languageId());
this.parmReportContract().parmRdlContract().parmLanguageId(CompanyInfo::languageId());
this.parmReportContract().parmRdlContract().parmLabelLanguageId(CompanyInfo::languageId());
}

When i debug the code , i found that the below code is iterating and never coming out of while loop  because of empty parmReferencedTableBuffer 

class -> PrintMgmt Method ->getnodeInstance() , 

// If parentBuffer is null and should not be, move to up until we find a valid parent. It is possible
// for certain nodes to not reference any data and they should be skipped when traversing the hierarchy.
while (parentInstance != null && !parentInstance.isValidReference())
{
parentInstance = hierarchy.getParent(parentInstance, documentType);
}

I have tried changing the code as below , but still the same issue

Classes\PrintMgmtHierarchy_Invent_Extension

protected PrintMgmtNodeInstance getParentImplementation(PrintMgmtNodeInstance _nodeInstance, PrintMgmtDocumentType _docType)
{
// Find the appropriate parent
PrintMgmtNodeInstance result;
InventTransferTable transfertable;

result = next getParentImplementation(_nodeInstance,_docType);

// Get the node instance type
switch (_nodeInstance.parmNodeDefinition().getNodeType())
{
case PrintMgmtNodeType::TransferOrderInvoice:
transfertable = _nodeInstance.parmReferencedTableBuffer();
result.parmReferencedTableBuffer(transfertable.selectRefRecord(fieldnum(InventTransferTable, TransferId)));

//result.parmReferencedTableBuffer(null);
result.parmNodeDefinition(PrintMgmtNode::construct(PrintMgmtNodeType::TransferOrderInvoice));
break;
}

I have the same question (0)

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 > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 301 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 120 Super User 2025 Season 2

#3
Siv Sagar Profile Picture

Siv Sagar 105 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans