Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

DimensionDynamicAccountController Class (Want to Create Lookup of Account Type and Account Num in New Table )

Posted on by 505

Hi all,

I have new table. In which I created two new fields

1) Name --> AccountNum, EDT--> DimensionDynamicAccount

2) Name --> AccountType, EDT--> LedgerJournalACType

Now I want look up same as in "LedgerJournalTransDaily"  form. i.e When Accounttype == Ledger then Lookup from LedgerAccount

When Accounttype == Customer then Lookup from CustTable.

For This I have followed the step in Page 19 in white paper"Implementing_the_Account_and_Financial_Dimensions_Framework_AX2012" which is given below

Microsoft Dynamics AX form control

The Multi-Type Account control represents a combination of the Segmented Entry control and the DimensionDynamicAccountController class. The Segmented Entry control is a general-purpose control that has been introduced in Microsoft Dynamics AX 2012. The

DimensionDynamicAccountController

class handles the events raised by the Segmented Entry control. This combination allows the control to handle accounts of several different types.

Changes needed on the form

In simple scenarios, the changes needed on the form are as follows:

1. Verify that the table that will hold the foreign key to the DimensionAttributeValueCombination table is a data source on the form.

2. Drag the LedgerDimension field from the data source to the desired location on the form design. This action should add a Segmented Entry control at this location on the form with appropriate

DataSource and ReferenceField property values. Alternatively, you can complete this step by adding a Segmented Entry control to the design and manually setting the DataSource and ReferenceField

properties.

3. Override the following methods on the form.

class declaration

:

public class FormRun extends ObjectRun

{

DimensionDynamicAccountController dimAccountController;

}

init (for the form):

public void init()

{

super();

dimAccountController = DimensionDynamicAccountController::construct(

ledgerJournalTrans_ds,

fieldstr(LedgerJournalTrans, LedgerDimension),

fieldstr(LedgerJournalTrans, AccountType));

}

4. Override the following methods on the Segmented Entry control instance in the form design.

public void jumpRef()

{

dimAccountController.jumpRef();

}

public void loadAutoCompleteData(LoadAutoCompleteDataEventArgs _e)

{

super(_e);

dimAccountController.loadAutoCompleteData(_e);

}

public void segmentValueChanged(SegmentValueChangedEventArgs _e)

{

super(_e);

dimAccountController.segmentValueChanged(_e);

}

public void loadSegments()

{

super();

// (Optional parm*() specification should go here, see the Control options section.)

dimAccountController.parmControl(this);

dimAccountController.loadSegments();

}

public boolean validate()

{

boolean isValid;

isValid = super();

isValid = dimAccountController.validate() && isValid;

return isValid;

}

5. Override the following methods on the data source field that backs the Segmented Entry control.

public Common resolveReference(FormReferenceControl _formReferenceControl)

{

return dimAccountController.resolveReference();

}

Now my problem is Lookup only works for AccountType=="Ledger" not for customer, Vendor etc.

it appears like

 

Please help me out in this

*This post is locked for comments

  • Suggested answer
    RE: DimensionDynamicAccountController Class (Want to Create Lookup of Account Type and Account Num in New Table )

    You need to override lookup method for your Ledger dimesnion(Account) control.

    Framework only provide auto lookup for account type 'ledger'. For other account types you need to write code in lookup method as below:

    public void lookup()

    {

       switch (TableName.AccountType)

       {

           case LedgerJournalACType::Ledger:

               super();

               break;

           case LedgerJournalACType::Cust:

               CustTable::lookupCustomer(this, TableName.Company);

               break;

           case LedgerJournalACType::Vend:

               VendTable::lookupVendor(this, TableName.Company);

               break;

           case LedgerJournalACType::Bank:

               BankAccountTable::lookupBankAccount(this, TableName.Company);

               break;

           case LedgerJournalACType::FixedAssets:

               AssetTable::lookupAccountNum(this, TableName.Company);

               break;

           case LedgerJournalACType::Project:

               ProjTable::lookupProjId(this, TableName);

               break;

           case LedgerJournalACType::RCash:

               RCashTable::lookupAccountNum(this, TableName.Company);

               break;

           case LedgerJournalACType::Employee_RU:

               EmployeeTable_RU::lookupAdvHolder(this, TableName.Company);

               break;

          default:

               // Do nothing.

               break;

       }

    }

  • dolee Profile Picture
    dolee 11,279 on at
    RE: DimensionDynamicAccountController Class (Want to Create Lookup of Account Type and Account Num in New Table )

    Hi,

    Can you send an xpo with the code to dlee@pbc.co.jp?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans