Skip to main content

Posts

Showing posts from February, 2025

🔄 Convert Available Inventory to Kilograms (KG) in X++ – D365 F&O

When working with raw materials in Dynamics 365 Finance & Operations (D365 F&O), it’s common to encounter situations where the inventory is stored in one unit (like Liters or Packs), but needs to be viewed or calculated in Kilograms (KG) for costing, reporting, or analysis. In this blog, we’ll walk through a practical X++ code snippet that demonstrates how to convert available inventory (AvailPhysical) into KG using D365’s standard Unit of Measure (UOM) conversion. 📌 Business Scenario Suppose you have a chemical item stored in Liters , but the production or costing team needs to see its available inventory in KG . You’ll need to: Fetch the item’s AvailPhysical from the InventSum table. Get the current unit of measure (UOM) for the item. Convert that quantity into KG , based on predefined unit conversion. 💻 X++ Code – Inventory Conversion to KG Here’s the code block that does exactly that: //******************** Avail Physical as per KG Unit conversion *...

How to Refresh a Form or Data Source in D365FO Using X++

  Introduction In Microsoft Dynamics 365 Finance & Operations (D365FO), refreshing the form after an action (like inserting, updating, or deleting a record) is essential for keeping the UI updated with the latest data. In this blog, we’ll explore two ways to refresh the form in X++: ✅ Refreshing the entire form using taskRefresh ✅ Refreshing a specific data source using research Let's dive into the best practices for implementing these refresh methods! 🔄 Refreshing the Entire Form If you need to refresh the whole form , use the taskRefresh method. This method is useful when multiple data sources are involved, and you want to reload everything. 📌 X++ Code for Full Form Refresh public void refreshForm() {     // Get the current form instance     FormRun formRun = this.formRun();     // Check if formRun is valid before refreshing     if (formRun)     {         info("Refreshing the form...");     ...