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

Notifications

Announcements

No record found.

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.
I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 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?
  • Community member 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
    237,878 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
    Community member 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

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
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans