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

Notifications

Announcements

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,376 Super User 2025 Season 2 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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 732 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 413 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 289 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans