Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Creating LedgerDim val...
Finance forum

Creating LedgerDim value for GJ with account type Customer

(0) ShareShare
ReportReport
Posted on by 1,355

Hello Folks,

I have a requirement wherein I am creating GJ with account type as customer through code, when I do this system automatically creates LedgerDimension based on value being passed in method LedgerJournalTrans.parmAccount() which is my Customer account number and account type. Here default dimensions are also fetched automatically from the customer master to create Ledger dimension.

Now I need to do a customization wherein my default dimension should not be fetched from Customer master but must be created based on values which we want to pass (I able to create a default dimension with req logic correctly) but further I am not able to create LedgerDimension by using this Default dimension and customer account number, can someone suggest how can I achieve this ?

Further let me point out I successfully created Ledger dimension for scenario where account type is Ledger by combining my default dimension with main account, but same code doesn't work with account type customer and not sure instead of main account weather I can pass customer account number.

  • CU06080557-0 Profile Picture
    on at
    Creating LedgerDim value for GJ with account type Customer
     

    LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber('CustomerID', LedgerJournalACType::Cust)

    The above method is depricated now, can someone please tell the new ,ethod to set the ledgerDimension with differents semgamnts ?

  • AxTushar Profile Picture
    1,355 on at
    RE: Creating LedgerDim value for GJ with account type Customer

    Thanks Satish and Sukrut for sharing your knowledge and clearing all my questions and understanding.

    Hope this conversation will help others. Thanks again.!

  • Verified answer
    Satish kakileti Profile Picture
    185 on at
    RE: Creating LedgerDim value for GJ with account type Customer

    Hi Tushar,

    There is no need to override ledger dimension.

    But when you are assigning values, write code for ledger dimension field first and tablebuffer.modifiedField(fieldnum(TableName, LedgerDimension)) in the next line and after that write code for assigning your default dimension value, why because the moment you select ledger dimension , default dimension will be picked from the master by default. So if you write in the above format, your default dimension can override the existing default dimension.

    Thanks,

    Satish Kakileti.

  • Verified answer
    Sukrut Parab Profile Picture
    71,682 Moderator on at
    RE: Creating LedgerDim value for GJ with account type Customer

    Hi Tushar ,

    When you select type as customer and select customer manually behind the scenes ledger dimension field is field in . code below  does  the same thing for you.

    LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber('CustomerID', LedgerJournalACType::Cust)

    Now when you click financial dimension button  and select dimension over there that when default dimension field is filled in . Hope this is clear now. You don't have to override ledgerDimension field  with anything .

  • AxTushar Profile Picture
    1,355 on at
    RE: Creating LedgerDim value for GJ with account type Customer

    Hi Satish,

    Thanks for helping me understand.

    I am pretty clear now but I don't want my default dimensions from customer master.. I am creating my own default dimension I'd.. now as per your suggestion I will assign newly created default dimension I'd to default dimension field of my journal line.. and will also create ledger dimension for customer by using:

    LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber('CustomerID', LedgerJournalACType::Cust)

    Below are my observation:

    1. I can see in journal line form that I have successfully overridden customer default dimension with default dimension as per my logic as required by business

    2. But I see Ledger dimension field value to be same as previous

    Thus my question now is:

    1. Is it now alright to post journal with newly created default dimensions ? Will it give me correct impacts

    2. Or I am required to override ledger dimension field also ? This is because I have overridden default dimensions from customer master with my own default dimensions in DefaultDimension field of my journal line

    Thanks again :)

    Tushar

  • Suggested answer
    Satish kakileti Profile Picture
    185 on at
    RE: Creating LedgerDim value for GJ with account type Customer

    Hi Tushar,

    As Andre said, there is one designated field for default dimension in journal lines in case account type is customer or vendor or bank or asset, so there is no merging of dimensions required here. In your case, first you should create ledger dimension for customer i.e., using LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber('CustomerID', LedgerJournalACType::Cust) and you can pass the default dimension of customer to the journal line default dimension.

    Thanks,

    Satish Kakileti.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,682 Moderator on at
    RE: Creating LedgerDim value for GJ with account type Customer

    You should try using code which I shared from my blog or refer my blog . You can look at the section where it says get lederdimension for any account type.

  • AxTushar Profile Picture
    1,355 on at
    RE: Creating LedgerDim value for GJ with account type Customer

    Thanks Andre for your valuable reply.

    So does this mean that I don't have to use LedgerDimension field for account type customer or vendor and only need to populate value in DefaultDimension field ?? although I see system does create a value in this field along with fetching dimensions from customer master.

    Again I just want to know how can I create Ledger dimension field value with x++ code for journal line with account type to be customer or vendor ?

  • Suggested answer
    Sukrut Parab Profile Picture
    71,682 Moderator on at
    RE: Creating LedgerDim value for GJ with account type Customer

    Customer and vendor are part of defaultDimension . If you want to merge default dimension with ledgerdimension then use class LedgerDimensionfacade lass mergeLedgerDimensions

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    294,336 Super User 2025 Season 1 on at
    RE: Creating LedgerDim value for GJ with account type Customer

    Hi Ax_Tushar,

    When you are using a main account, the dimensions will be part of the LedgerDimension field. If you are using another account type like a customer or vendor, the LedgerAccount will only contain the customer or vendor number. The dimensions should then be created and stored using the DefaultDimension field of the LedgerJournalTrans table.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,336 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,025 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans