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

Adding extra fields to posted VAT form

(0) ShareShare
ReportReport
Posted on by 7
Hi, 
 
There is a requirement for extra fields on Posted VAT/ Posted sales tax form.
 
I want to add 7 extra fields on the posted VAT form which is under tax module
Tax > Inquiries and Reports > Sales Tax inquiries > Posted sales tax
 
The fields are -
Invoice number
Gross Amount
Vat Code Description
Customer/Supplier code
Customer/Supplier name
Description from sales/purchase invoice line
Country region code of customer/vendor
 
Gross amount I got from display method, but for other fields, I need the filed to be filterable also, hence I'm not able to add display methods for these fields.
 
Since, these fields i can fetch from vendtrans, custtrans and ledger trans table, i think i would need to update taxtrans table by adding these fields as physical fields on taxtrans table and updating them but im not able to get a trigger point where i can call this update or any other approach would be appreciated.
 
Many thanks.
Please guide.
  • Martin Dráb Profile Picture
    240,742 Most Valuable Professional on at
    The ability to filter doesn't necessarily require the fields to be in the same table - you could use a join table or view instead. For example, you could combine information from several related tables in a view and join this view with TaxTrans.
     
    But the first step must be different - you need to think about the queries to fetch the data, e.g. which tables to use, what the relations are and whether a single value can be obtained at all.
     
    For example, you want to get "Description from sales invoice line" and you want to use CustTrans table, but invoice line is CustInvoiceLine, isn't it? If you actually want CustInvoiceLine, you can use a relation over SourceDocumentLine.
     
    Regarding Invoice number, don't you already have it in TaxTrans.InvoiceId?
  • SS-27040854-1 Profile Picture
    7 on at
    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.
  • Verified answer
    Martin Dráb Profile Picture
    240,742 Most Valuable Professional on at
    I don't agree your only option to get values from either customers or vendors is using computed columns. The most natural approach would be using an union query.
  • Suggested answer
    SS-27040854-1 Profile Picture
    7 on at
    Thanks, Martin.
     
    We went with a batch job first to update the fields every 15 min but later on, the client said they didn't want a filter explicitly so we went ahead with display methods.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 366

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 360 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans