Creating a Delegate method
The Delegate
method is also very helpful to minimize overlaying, and you can use the Delegate
method to communicate objects that exist in different packages/models and help to solve dependencies between models when migrating code. Delegate
can be very useful when you need to use two objects that are not in the same package. Use the delegate concept by defining a contract between the delegate instance and the delegate handler. We have a new structure of Dynamic 365 for Operations--you will not be able to use an object outside of its own package. So, to use delegate in such situations a delegate declaration must have three things--a Delegate
keyword, return type should be void
, and it should be an empty method.
Let's understand it using the following recipe.
Getting ready...
To understand this recipe, let's consider a scenario. We have a requirement where we are creating an Expense
journal through code and to identify such transactions we added a new field on the LedgerJournalTrans...