D365/AX7:Ledger/Financial Dimension Lookup In Form (Segmented Control)

Requirement

Ledger/Financial Dimension Lookup In Form (Segmented Control)

Steps

  1. Create 2 fields LedgerDimension (Int64) & AccountType (Enum-LedgerJournalACType) in table.
  2. Create a table relation of field LedgerDimension to DimensionAttributeValueCombination table.

Capture

 

3. Add fields LedgerDimension (Int64) & AccountType (Enum-LedgerJournalACType)             in form.

Capture.JPG

4. Change the properties of segmented control LedgerDimension:

– Auto declaration : Yes
– Account type field : AccountType
– Controller class : DimensionDynamicAccountController
– Filter expression : %1

5.Override the datasource’s field LedgerDimension modified() method

public void modified()
{
super();
SampleTest_LedgerDimension_ds.refresh();
}

6.Override the Form’s segment entry control LedgerDimension lookup() &                               checkUseCustomLookup() methods.

public boolean checkUseCustomLookup(int _accountTypeEnumValue, int _secondaryAccountTypeEnumValue)
{
boolean returnValue;

LedgerJournalACType accountType = any2Enum(_accountTypeEnumValue);
switch (accountType)
{
case LedgerJournalACType::Bank:
case LedgerJournalACType::Cust:
case LedgerJournalACType::FixedAssets:
case LedgerJournalACType::Project:
case LedgerJournalACType::Vend:
returnValue = true;
break;
default:
returnValue = false;
break;
}

return returnValue;
}

public void lookup()
{
switch (SampleTest_LedgerDimension.LedgerJournalACType)
{
case LedgerJournalACType::Bank:
BankAccountTable::lookupBankAccount(this);
break;
case LedgerJournalACType::Cust:
CustTable::lookupCustomer(this);
break;
case LedgerJournalACType::FixedAssets:
AssetTable::lookupAccountNum(this);
break;
case LedgerJournalACType::Vend:
VendTable::lookupVendor(this);
break;
default:
super();
break;
}
}

Capture

Cheers!

Leave a Reply