We can create extension for class but can use/call only Public Members/Methods. Private and Protected can not be accessed from Extension Class.
Added new field TstField in MainAccount Table using extension.
Would like to show newly added field on Trail balance Form/Report.
Added new field TstField in LedgerTrialBalanceTmp Table using extension.
/// <summary>
/// Extension Class
for LedgerTrialBalanceDP
/// </summary>[ExtensionOf(classStr(LedgerTrialBalanceDP))]
final class
HNWLedgerTrialBalanceDP_Extension
{
protected void new()
{
}
///
Updating new field in <c>LedgerTrialBalanceTmp</c> Table
///
</summary>
public void UpdateTstField()
{
MainAccount mainAccount;
DimensionAttributeValueCombination ledgerDimension;
LedgerTrialBalanceTmp ledgerTrialBalanceTmp;
ledgerTrialBalanceTmp = this.getLedgerTrialBalanceTmp();
update_recordset ledgerTrialBalanceTmp
settingTstField = mainAccount.TstField
join mainAccount
exists join ledgerDimension where
ledgerDimension.MainAccount == mainAccount.RecId &&
ledgerDimension.RecId == ledgerTrialBalanceTmp.LedgerDimension;
this.setTrialBalanceTmpTable(ledgerTrialBalanceTmp);
}
}
Create postEventHandler for processReport method in LedgerTrialBalanceDP Class
and call our newly created method in Extension Class of LedgerTrialBalanceDP
public class HNWLedgerTrailBalanceHandlersExt
{
[PostHandlerFor(classStr(LedgerTrialBalanceDP), methodStr(LedgerTrialBalanceDP, processReport))]and call our newly created method in Extension Class of LedgerTrialBalanceDP
public class HNWLedgerTrailBalanceHandlersExt
{
public static void
LedgerTrialBalanceDP_Post_processReport(XppPrePostArgs args)
{
LedgerTrialBalanceDP ledgerTrialBalanceDP
= args.getThis();ledgerTrialBalanceDP.UpdateTstField();
}
}
Thanks for sharing your valuable information and time. Please keep updating
ReplyDeleteMicrosoft Dynamics AX Online Training
This comment has been removed by the author.
ReplyDeleteThanks for sharing this wonderful content.its very useful to us.I gained many unknown information, the way you have clearly explained is really fantastic.
ReplyDeleteoracle training in chennai
oracle training institute in chennai
oracle training in bangalore
oracle training in hyderabad
oracle training
hadoop training in chennai
hadoop training in bangalore
best institute in Hyderabad is leo training institute
ReplyDelete
DeleteBest institute in Hyderabad is Data Science School i really love your contain
https://datascienceschool.in/
This comment has been removed by the author.
ReplyDeleteGreat explanation! This article made the concept of class extensions in D365 much clearer. The step-by-step breakdown and practical examples are really helpful for anyone working with Dynamics customization.
ReplyDeleteBy the way, if anyone here is interested in exploring advanced embedded technologies or upgrading their technical skills, you can also check out the Best Embedded Systems Institute in Hyderaba. They share a lot of useful content on embedded systems, IoT, and real-time development.
Thanks for sharing this valuable post!
Amazing article! Really informative and easy to understand. Thanks for posting!
ReplyDeletestock marketing Training in Hyderabad