Announcements
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;
}
}
ledgerJournalTransVendInvoice.LedgerDimension = LedgerDynamicAccountHelper::getDynamicAccountFromAccountNumber(vendorAccountNum, LedgerJournalACType::Vend);
ledgerDimension = DimensionStorage::findByLedgerDimension(LedgerDimensionFacade::getDefaultDimension(vendorAccountNum));
ledgerJournalTransVendInvoice.parmAccount(ledgerDimension.ledgerDimension());
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156