| Customizing SSRS Report Using Extension in D365FO Steps |
| ● Create extension of FreeTextInvoiceTmp table and add the field i.e. TotalAmounInWords |
| ● Create a class named FreeTextInvoiceController_Events to implement the event handler methods |
| ● Copy the post handler event method of processReport() of FreeTextInvoiceDP
class and paste in the class created in previous step. |
| NOTE: You can also use the OnInserting event of table instead of processReport() of DP class. |
| ● Write the following logic to insert the data into the TotalAmounInWords field we have created: |
| class FreeTextInvoiceController_Events |
| { |
| [PostHandlerFor(classStr(FreeTextInvoiceDP), methodStr(FreeTextInvoiceDP, processReport))] |
| public static void FreeTextInvoiceDP_Post_processReport(XppPrePostArgs args) |
| { |
| FreeTextInvoiceDP dpInstance = args.getThis() as FreeTextInvoiceDP; |
| FreeTextInvoiceHeaderFooterTmp freeTextInvoiceHeaderFooterTmp = dpInstance.getFreeTextInvoiceHeaderFooterTmp(); |
| FreeTextInvoiceTmp freeTextInvoiceTmp = dpInstance.getFreeTextInvoiceTmp(); |
| ttsbegin; |
| while select forUpdate freeTextInvoiceTmp |
| { |
|
freeTextInvoiceTmp.TotalAmounInWords = numeralsToTxt(freeTextInvoiceTmp.InvoiceAmount); |
| freeTextInvoiceTmp.update(); |
| } |
| ttscommit; |
| } |
| } |
| ● Find out the FreeTextInvoice report in the AOT |
| ● Right-click the report and click Duplicate in project. |
| ● Customize the design and add TotalAmountInWords field as per your requirements |
| ● Create
another class named FreeTextInvoiceControllerExt which extends the FreeTextInvoiceController class. Override the main() method. ●Give the new report and it’s design name in it. |
| ● Add the following logic in FreeTextInvoiceControllerExt class: |
| class FreeTextInvoiceControllerExt extends FreeTextInvoiceController |
| { |
| public static FreeTextInvoiceControllerExt construct() |
| { |
| return new FreeTextInvoiceControllerExt(); |
| } |
| public static void main(Args _args) |
| { |
| SrsReportRunController formLetterController = FreeTextInvoiceControllerExt::construct(); |
| FreeTextInvoiceControllerExt controller = formLetterController; |
| controller.parmReportName(ssrsReportStr(FreeTextInvoiceCopy, Report)); |
| controller.parmArgs(_args); |
| controller.startOperation(); |
| } |
| } |
| ● Create extension of the following menu items which executes report: |
| ● FreeTextInvoiceCopy |
| ● FreeTextInvoiceOriginal |
| ● Change the controller class name in the Object property of the extended menu items to the FreeTextInvoiceControllerExt class created above |
| ● Save, build and synchronize and deploy the project/reports. |
| Optional if Print Management is there |
| ● Create another class named PrintMgtDocTypeHandlersExt |
| ● Add a
method in it which subscribes to the event delegate of PrintMgmtDocType class to re-route the report from the default to this customized report |
| ● Add the following logic in PrintMgtDocTypeHandlersExt class: |
| class PrintMgtDocTypeHandlersExt |
| { |
| [SubscribesTo(classstr(PrintMgmtDocType), delegatestr(PrintMgmtDocType, getDefaultReportFormatDelegate))] |
| public static void getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result) |
| { |
| switch (_docType) |
| { |
| case PrintMgmtDocumentType::SalesFreeTextInvoice: |
| _result.result(ssrsReportStr(FreeTextInvoiceCopy, Report)); |
| break; |
| } |
| } |
| } |
Wednesday, 11 December 2019
Customizing SSRS Report Using Extension in D365FO Steps
Subscribe to:
Post Comments (Atom)
POSTMAN D365
Postman is useful to test the behavior of different OData class from/to D365FO. In this post we will see the steps to setup Postman with D...
-
Form data source event handler [FormDataSourceEventHandler(formDataSourceStr(EcoResProductDetailsExtended, InventTable), FormDataSour...
-
Sales & Purchase Classes & Tables SalesOrder Classes : SalesTableType and SaleslineType classes will get called...
-
Here is a sequence of method’s calls during export: https://rahulmsdax.blogspot.com/2019/08/data-entity-methods-execution-sequence.html 1. i...
No comments:
Post a Comment