Skip to main content

Notifications

Microsoft Dynamics AX forum
Suggested answer

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

  • 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?

Helpful resources

Quick Links

Dynamics 365 Community Update

Welcome to the inaugural Community Platform Update. As part of our commitment to…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Community Spotlight of the Month

Kudos to Mohana Yadav!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,107 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,954 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans