Hello Everyone,I would be posting a method through which we need not to write a single line of code to achieve the Main Account lookup.
I will explain in very easy steps which handles the Main Account lookup and Financial dimensions(Main Account- Cost Center-Business- Purpose) lookup.
We had a requirement that to add a Lookup of Main Account on Account Receivable Parameters( Table Cust Parameters).
In Dynamics 365 for Finance and Operations, we can achieve this by using segmented entry control .
What’s Segmented Entry Control ? The segmented control consists of a dynamic number of elements(segments ).The number of segments may vary depending on the setup, and their lookup values may depend on the values specified in other segments in the same control like Main Account- Cost Center-Business- Purpose.
So we will add segmented entry control to show an account number and related dimensions from the chart of accounts on our form.
Lets start with the steps how to quickly get this working on Dynamics 365 for Finance and Operations form.
1.Create an extension of Table CustParameters with name “CustParameters.Extension” and foreign Key Relationship with Table DimensionAttributeValueCombination.
You will see an additional field with Name “LedgerDimension” after foreign key relation
2.Now set below properties on newly added relation
- Table- DimensionAttributeValueCombination
- Index- RecId
- RelatedTableCardinality- ExactlyOne
- Cardinality- ZeroMore
- Relationship type- Association
- Related table role – DimensionAttributeValueCombination
- Role- DimensionAttributeValueCombination_CustParameter
- UseDefaultRoles -No
- Name :LedgerDimension
3.Now we will add an new control “SegmentedEntry ” on Account Receivable Parameters form extension “Custparameters.Extension” and set below properties
- Set control name “MainAccount”.
- Data source CustParameters
- Filter expression %1
- Auto declaration Yes
- Reference field LedgerDimension
- Controller class LedgerDimensionDefaultAccountController
- Label “Main Account”
The segmented entry control always uses the controller class, which handles the entry and display in the control.In addition, If you do not add the controller class to the control, the segmented entry control will not show any information.
We have used the LedgerDimensionDefaultAccountController class for a segmented entry control that shows main accounts.
Happy Daxing. 🙂