Create main
account lookup like general journal main account drop down through code X++,
Dynamics 365 Finance and Operation 
Look up
like below
Step : 01
·       
Create
a table with two below fields.
o  
 Account Type -> Base enum ->
LedgerJournalACType
o  
DefaultDimension
-> EDT -> DimensionDynaminAccount
Step : 02
Add this
table into your form datasource. DON’T update the property ‘Insert of empty =
No’, left all properties as default. It will create a default line when
datasource is initialized with value as ‘Ledger’ which will be parameterized
for the DefaultDimension field.  You update
Allow create/Delete/Check = No.
Step :
03
Create a
datagroup control in the Form and drag two fields from the datasource table into the
group.
Step : 04
Update the
Default dimension properties with following values.
Step : 04
Attaching
legal entity value, so that drop down will be populated with the selected LE’s
data
- ·       
Add
an unbound string control in the form and 
- ·       
Override
the modified method
- ·       
write
the code as below.
| [Control("String")]    
  class
  LegalEntityContrl    
  {         public boolean modified()         {             boolean ret;                     
  DefaultDimension.setDataAreaId(LegalEntityContrl.text());            
  AD_tmpMainAccountLedgerCategory.DefaultDimension = 0;             ret = super();                      return ret;         } | 
Step :
06
Build the
project and validate
Note: This illustration
will display all Main Accounts as drop down, if you want to display Customer/Vendor/Project
and others then you need to create a record in the MainAccountLedgerCategory
table with AccountType = ‘your required element’.




 
 
No comments:
Post a Comment