Monday, October 21, 2019

Update method parameters using Pre Event Handler

Update method parameters using pre event handler

Some time we need to update methods parameters value. In this blog i will show you that how can we achieve this using "Pre Event Handler" in Microsoft Dynamics 365 Finance and Operations.

Example:
Suppose we have multiple designs for "FreeTextInvoice" Report and we always want to pick the Design from "PrintManagement".
For achieve this requirement i am using out of the box form and create the "pre-event handler" of it's method to updates its parameters value

Form Name : CustFreeInvoice
Method Name : printInvoice



Please follow the following steps
  • Go to AOT using Visual Studio and Search "CustFreeInvoice" in Application Object Tree
  • Right click on CustFreeInovice inside the Forms node and click on "Open designer"
  • Search "printInvoice" in the Searchbar of the form
  • Right click on the "printInvoice" method then click on "Copy event handler method" then click on "Pre-event handler"
  • Create new class as "CustFreeInvoiceHandler" and Paste event handler in this class it looks like as shown below
  • Now add the following code to update the value of the parameter





No comments:

Post a Comment

Post Event Handler

In Dynamics 365 F&O we are not allowed to add our custom logic in between the  core logic  but we can execute our custom logic before ...