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, ...
Suggested Answer

How to Calculate GST for Indian legal entity for a custom table using SAC/HSN code using x++

(4) ShareShare
ReportReport
Posted on by 958
HI All ,

I have a custom form and table(ISV) , i need to calculate GST using the SAC code defined at line table.

Kindly suggest any idea or workaround or how to kickstart. As far i've seen, GST can be calculated to standard process and standard tables.

if anybody have completed for ISV tables/forms, please let me know.

Thank you in advance
I have the same question (0)
  • Suggested answer
    Assisted by AI
    ANInnoSolutions Profile Picture
    446 on at
    Hi TestBot,
     
    1) Issue
    - Requirement to calculate GST (India) for a custom ISV table/form in D365 Finance using SAC/HSN code
    - Standard GST calculation works only for standard modules (Sales, Purchase, Free text invoice, etc.)
    - Custom tables do not automatically trigger tax calculation
    - Need to integrate tax engine logic into custom process
    - Expectation is to reuse standard tax/GST framework instead of building logic from scratch
     
    2) Reason
    - The limitation is caused by GST calculation in D365 being tightly integrated with the Tax engine framework (Taxable document model)
    - Standard GST calculation is triggered through document frameworks such as SalesLine, PurchLine, LedgerJournalTrans, etc.
    - A required structure such as TaxableDocument, TaxIntegration, and TaxBusinessService is not present in custom tables by default
    - This leads to a situation where tax engine cannot identify the custom transaction and therefore does not calculate GST
    - This can happen because SAC/HSN-based tax calculation depends on tax setup, tax groups, item groups, and document metadata which must be explicitly provided to the engine
     
    3) Resolution
    - Use the standard Tax engine framework instead of manual GST calculation
     
    Step 1: Identify required tax inputs
    - SAC/HSN code (from your custom line table)
    - Tax group
    - Item sales tax group
    - Currency and amount
    - Date and company context
     
    Step 2: Use TaxableDocument framework
    - Create a custom TaxableDocument implementation for your table
    - Map your custom fields (amount, SAC/HSN, quantities) to tax engine fields
    Example concept:
    - Extend or mimic classes used in: SalesLine → TaxableDocument, PurchLine → TaxableDocument
     
    Step 3: Call TaxBusinessService
    - Use standard tax calculation service:
    - Code example (simplified):
     
    TaxableDocumentObject taxableDocument;
    TaxBusinessService taxBusinessService;
    TaxDocument taxDocument;

    taxableDocument = YourCustomTaxableDocument::construct(_yourCustomTableBuffer);

    taxBusinessService = TaxBusinessService::construct();
    taxDocument = taxBusinessService.calculateTax(taxableDocument);
     
    Step 4: Read calculated GST
    - Loop through taxDocument lines:
     
    TaxDocumentComponentLine componentLine;
    while select componentLine
        where componentLine.TaxDocument == taxDocument.RecId
    {
        info(strFmt("Tax Amount: %1", componentLine.TaxAmount));
    }
     
    Step 5: Ensure setup is correct
    - SAC/HSN code must be linked to:
    - Item sales tax group
    - Tax group
    - GST components (CGST, SGST, IGST)
    - Check Tax setup:
    - Tax > Setup > Sales tax
    - India GST feature must be enabled
     
    Step 6: Alternative quick approach (if full framework is too heavy)
    - Reuse an existing table (like PurchLine or SalesLine)
    - Temporarily simulate your data into that buffer
    - Call tax calculation
    - Extract result
    - Not ideal but faster for ISV scenarios
     
    Key considerations
    - Do not manually calculate GST rates
    - Always use tax engine to ensure:
    - Compliance
    - Future updates
    - Localization correctness
     
    Common pitfalls
    - Missing tax group or item tax group
    - SAC/HSN not linked in tax setup
    - Not using TaxableDocument structure
    - Trying to calculate GST only via percentage logic
     
    Best practice
    - Treat your custom table like a standard document line
    - Plug into Tax engine via TaxableDocument
    - Keep logic reusable and aligned with Microsoft framework
     
    Key takeaway
    - GST calculation in D365 Finance is not standalone logic
    - It is driven by the Tax engine and TaxableDocument framework
    - To support custom tables you must integrate with this framework instead of bypassing it
     
    For a more detailed answer, please provide more information.
     

    Rg,

    Alexander

    *Due to the complex and different possibilities of deploying Dynamics 365 I highly recommend not to setup the application without some expert/partner or support. (For more information contact me under anassl@inno-solutions.info or visit www.inno-solutions.de)

    *The Information comes directly from the manufacturer or provider and are validated (not guaranteed) up to date of creation of the posting.

    References:

    1. Microsoft Licensing Guide
    2. Microsoft Doc`s/Learn
  • Suggested answer
    Deepak Agarwal Profile Picture
    8,791 on at
     Did you explored TaxGSTInvoiceHelper_IN class? There is method getGSTPayableAmount which needs ITaxDocumentLine class as parameter, you need to play around this class. 
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 622

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 532 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 430

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans