Skip to main content

Posts

Showing posts from November, 2025

🔎 How to Get Line-wise Other Charges Tax Amount in D365FO (IGST / CGST / SGST)

 In many D365FO implementations (especially India GST projects), we often need: Line-wise Other Charges Tax Amount Split into IGST, CGST, and SGST For Posted Customer Invoice Lines (CustInvoiceTrans) By default, D365FO stores: Invoice Lines → CustInvoiceTrans Charges → MarkupTrans Tax → TaxTrans To get accurate charges tax per invoice line, we must follow proper table relation hierarchy. 📌 Table Relationship Structure CustInvoiceTrans → MarkupTrans → TaxTrans Relationship Logic: MarkupTrans.TransTableId == tableNum(CustInvoiceTrans) MarkupTrans.TransRecId == CustInvoiceTrans.RecId TaxTrans.SourceTableId == tableNum(MarkupTrans) TaxTrans.SourceRecId == MarkupTrans.RecId This ensures we fetch only Charges Tax , not Item Tax. 🧠 Business Requirement For each invoice line, we need: IGST Amount CGST Amount SGST Amount Converted to positive value (if negative) 💻 X++ Code – Line Wise Charges Tax Calculation Cus...

💡 X++ Tip: Keep the Same Record Selected After Refresh in a Form or Data Source

 When you refresh a form data source in Dynamics AX or Dynamics 365 for Finance and Operations, the current selection is often lost — the cursor jumps back to the first record. This can be frustrating, especially if you want the user to remain on the same record after an update or refresh. Here’s a simple and reliable way to restore the cursor to the same record after the data source is refreshed. 🧩 Scenario Suppose we have a form displaying records from MyTable . When we refresh the data source — for example, after updating a field or calling executeQuery() — we want the form to return to the same record the user was viewing before the refresh. ✅ Solution: Use ds.cursor() We can achieve this using a record buffer and the cursor() method of the data source. public void refreshDataSource() { MyTable myTableRec; // buffer to store current record // Store the current record myTableRec = MyTable_ds.cursor(); // Refresh the data source MyTable_ds.r...