web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Vendor account number is stored in the LedgerDimension format.

(1) ShareShare
ReportReport
Posted on by 275

Hi everyone,

There is a form called BulkTagDestroy in which I created a field to insert the vendor account number through a dropdown, and I am retrieving that value in a variable called vendorAccountNum. Upon clicking a button, the details from that form are sent to the LedgerJournalTable, creating a new line there. Once created, I capture the journal batch number of the newly created line. Against that journal number, I need to go to the LedgerJournalTrans table and create a new record, adding the vendor details as well.

The problem I am facing is that in the LedgerJournalTrans, the vendor account number is stored in the LedgerDimension format. I am unsure how to retrieve it and from where. This is where I need assistance.

Environment : D365 F&O
Note : ledgerDimension2AccountNum this method are not available on my environment 

public void clicked()
    {
     ledgerJournalTrans ledgerJournalTransVendInvoice;

   
      vendorAccountNum =  BulkTagDestroy_AccountId.text(); 
       BulkTagDestroyDetailSel =  BulkTagDestroyDetail_DS.cursor(); 

      if ( BulkTagDestroyDetailSel)
      {

        makingCharges =  BulkTagDestroyDetailSel.makingCharges(); 
      }
  
      if ( BulkTagDestroy.JournalNum) 
      {
        error("Debit note is already generated for this entry.");
        return;
      }
      ttsBegin;
      try
      {
        ledgerJournalTable.JournalName = 'DBN';
        ledgerJournalTable.Name = "Note";
        ledgerJournalTable.initValue(); 

        ledgerJournalTable.insert();

        journalId = ledgerJournalTable.JournalNum;


        ledgerJournalTransVendInvoice.initValue();
       
       
        ledgerJournalTransVendInvoice.AccountType = LedgerJournalACType::Vend;
        ledgerJournalTransVendInvoice.Txt = "Debit Note - Vendor Invoice";
        ledgerJournalTransVendInvoice.AmountCurDebit = makingCharges;
	ledgerJournalTransVendInvoice.LedgerDimension =(Vedndor account number format)
        ledgerJournalTransVendInvoice.insert();
     
         BulkTagDestroy.JournalNum = journalId;
         BulkTagDestroy_ds.research(true);
        ttsCommit; 

      }
      catch (Exception::Error)
      {
        ttsAbort; 
       }
    }
Thanks for the help!! Feel free tp ask anything if you want clarity on the requirement.
I have the same question (0)
  • Suggested answer
    Anton Venter Profile Picture
    20,656 Super User 2026 Season 1 on at
    Hello,
     
    Use the standard parmAccount method on the LedgerJournalTrans table.
  • Verified answer
    Ayushaman Profile Picture
    275 on at
    Hi Antor,
     
    Thanks for the help! I used this for the problem and it working fine 
    ledgerJournalTransVendInvoice.LedgerDimension = LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber(vendorAccountNum, LedgerJournalACType::Vend);
    I also tried which you suggested the parmAccount but for this i think some methods are not defined on my environment .
            ledgerDimension = DimensionStorage::findByLedgerDimension(LedgerDimensionFacade::getDefaultDimension(vendorAccountNum));
            ledgerJournalTransVendInvoice.parmAccount(ledgerDimension.ledgerDimension());  
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 465 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans