Hi Martin, thanks for your reply.
I went with the view approach initially, but i have most of the fields where the information is being fetch from vendor or customer in the same field itself, so i'll have to write computed columns for each of the fields like customer or vendor name , customer or vendor code, or country code.
The computed columns are getting complicated. so i was thinking of doing a SysExtensionSerializerMap:postInsert() way, where we create a child table and insert the records post insert in parent table, but that also is not giving me results since the records are not written on the table before transaction is completed, so i don't get trans table or journals to fetch the data from.
Hence, i thought of going with update approach but i'm not able to find a trigger point to hit the update.
For now, i wrote it under FormletterService class, it is working but i dont know if it can disturb any other process also, since even while creating a PO, it goes through the same classes.
[ExtensionOf(classStr(FormletterService))]
final class FormletterService_Extension
{
/// <summary>
/// Creates totals, posts the journal and prints.
/// </summary>
/// <param name = "_printout">A <c>PrintOut</c> value.</param>
protected void processJournal(Printout _printout)
{
next processJournal(_printout);
if (ordersPosted)
{
TaxTrans taxTrans = TaxTrans::find(VendInvoiceJour::findRecId(journal.recid).LedgerVoucher, VendInvoiceJour::findRecId(journal.recid).InvoiceDate, true);
if (taxTrans)
{
ttsbegin;
InvoiceId invoiceID = VendInvoiceJour::findRecId(journal.recid).InvoiceId;
taxTrans.customInvoiceId = invoiceID;
taxTrans.update();
Info(strFmt('invoice id %1', taxTrans.customInvoiceId));
ttscommit;
}
}
}
}
Regarding InvoiceID on TaxTrans table, it is there but its not getting populated.
but there is a method to fetch the invoice number on taxtrans table which is sourceinvoiceno(), which i thought of using during update.
can you please help me out, i m stuck in this approach part.