Working with Dynamics 365 Finance & Operations form queries is usually straightforward—until you need to join multiple data sources using multiple fields coming from different tables. What is trivial in SQL can quickly become confusing when expressed through QueryBuildDataSource (QBDS), especially in forms that already contain a complex query tree. This article describes a real-world…
Security in Azure SQL Database often starts with the principle of least privilege: a user should have access only to what they need, nothing more. A common pattern is to create a contained database user who can log in directly to a database, own a private schema, and have full control only inside it —…
Enums are everywhere in Microsoft Dynamics 365 Finance and Operations (D365FO). They make code readable, enforce consistency, and keep logic clean. But when it comes to reporting or data exports—especially via SQL views—they can be frustrating. After all, SQL only sees the integer values behind the enum. The human-readable labels that make sense to us…
In Dynamics 365 Finance & Operations, it is often necessary to navigate from one form to another while preserving the context of the record you are working on. For instance, a user may want to open a detail form directly from a list page, so that the selected record is automatically carried over and displayed…
When working with date-time fields in Dynamics 365 Finance & Operations, it’s critical to store and display values consistently—especially if you’re in a region that observes Daylight Saving Time (DST). This article walks through a common pitfall and shows how to correct “local” date-times written as UTC, ensuring your users always see the right time…
When you’re working with two joined DataSources on a Dynamics 365 Finance & Operations form—using an OuterJoin for the child—you’ll often find that inserting or editing a parent record automatically creates an unwanted, empty child record. That placeholder can clutter the UI and confuse your users. Instead of fighting form properties or scattershot event handlers,…
In Dynamics 365 Finance and Operations (D365FO), tables with validity dates automatically filter out expired records. A common example is the LogisticsPostalAddress table, which hides expired addresses by default. This behavior can cause issues when displaying sales order lines joined with this table, as orders linked to expired addresses will also be excluded. To override…
In Dynamics 365 Finance & Operations, document attachments are categorized using the Restriction field, which determines access control levels. In many cases, businesses require that certain document types always have a predefined restriction value to ensure consistency and compliance. A common scenario is the need to automatically set the Restriction field to “External” for a…
In Microsoft Dynamics 365 Finance and Operations, you can add a custom lookup to a field in a form by overriding the lookup method of the control. This allows you to customize data display and enhance the user experience. Overriding the lookup Method To add a custom lookup, you need to override the lookup method…
In Dynamics 365 Finance and Operations (D365FO), the InfoLog is a key component used to display messages such as errors, warnings, and information logs. However, when working with batch jobs or processes that execute within the SysOperation Framework, messages in the InfoLog may be cleared or lost between executions. This article demonstrates how to save…
When working with AX (Dynamics AX), there are scenarios where padding numbers with zeros is necessary. One such example is in creating Positive Pay files, which often require fixed-width numeric values. Zero padding ensures that numbers maintain a consistent format, such as transforming “1” into “00001”. This guide demonstrates how to handle zero padding effectively…
In Microsoft Dynamics 365 Finance and Operations (D365FO), batch jobs are essential for automating and managing large-scale data processing tasks efficiently. Monitoring these batch jobs is crucial to ensure their successful execution and to troubleshoot any issues that may arise. One effective way to achieve this is by programmatically retrieving the infolog messages generated during…
When working with batch jobs in Microsoft Dynamics 365 Finance and Operations (D365FO), it’s often helpful to capture the system messages (infolog) generated during the batch’s execution. By retrieving these messages at runtime, you can then repurpose them—such as sending them via email notifications or storing them in a custom table for auditing or reporting…
Managing files between multiple OneDrive accounts can be tedious, especially if you frequently need to transfer files from one account to another. You can automate this process using tools like Power Automate or PowerShell. Power Automate provides a user-friendly interface for creating automated workflows, while PowerShell offers a more script-driven approach for advanced users. This…
In Dynamics 365 Finance and Operations (D365FO), working with metadata is a common task for developers. One powerful tool for accessing table and field metadata is the DictField class. This article explains how to use DictField to retrieve the name of a field programmatically. Understanding DictField DictField is a class in D365FO that provides metadata…
In Dynamics 365 Finance and Operations (D365 FO), it’s common to need views that dynamically filter records based on the current date. For example, a view might need to retrieve only those records where: However, setting up such filters directly in an AOT view can be tricky because: This article demonstrates a modular and scalable…
In Dynamics 365 Finance and Operations (D365FO), there are scenarios where developers need to work with table instances dynamically without hardcoding their names. This is especially useful in generic frameworks or scenarios where the table to be used is determined at runtime. In this article, we’ll explore how to dynamically create table instances using only…
In Microsoft Dynamics AX and Dynamics 365 for Finance and Operations (D365FO), there are times when you need to iterate over all the records displayed in a form’s grid. This could be for bulk updates, validations, or computations that need to be applied to each record individually. In this article, we’ll explore two methods to…
In Microsoft Dynamics 365 for Finance and Operations (D365FO), developers often need to customize standard functionalities to meet specific business requirements. A common scenario involves adding custom logic during the insert or update operations of tables like InventSum. While event handlers are a popular extension method in D365FO, they are not applicable to table methods…
When working with dates and times in Dynamics 365 Finance and Operations (D365FO), you often need to perform date arithmetic, such as adding or subtracting days or months from a given datetime value. X++ provides a robust set of utilities within the DateTimeUtil class to make such operations straightforward. In this article, we’ll explore how…
In Dynamics AX and Dynamics 365 Finance and Operations (D365FO), you may encounter situations where you need to force a query to use a specific index for optimal performance. This can be useful for improving query execution times, especially when dealing with large datasets or complex queries. This guide will show you how to use…
When developing forms in Dynamics 365 Finance and Operations (D365FO), you may find yourself needing to programmatically access specific form controls based on their names. This can be useful for dynamically manipulating control properties, applying custom logic, or performing validations. In this article, we’ll demonstrate how you can retrieve form control objects directly by their…
When dealing with strings containing comma-separated values (CSV) in Dynamics 365 Finance and Operations, it is often necessary to split the string into individual elements for further processing. In X++, one efficient way to achieve this is by using the strSplit() method. In this article, we’ll walk you through how to split a string and…
When working with Dynamics 365 Finance and Operations (D365FO), developers often need to retrieve specific details about table fields, such as whether they are mandatory, their base data type, and their labels. This can be incredibly helpful when customizing or debugging applications, understanding table structure, or creating reports. In this article, we’ll walk through a…
In this article, we’ll walk through a practical scenario that many developers in Dynamics 365 Finance and Operations (D365FO) face: limiting the number of characters a user can input into a form field without altering the table field definition itself. During this process, we’ll explore using the validateWrite method in a data source of a…
In the world of Microsoft Dynamics 365 development, there are often scenarios where you need flexible solutions that can adapt to various tables and data structures. In this article, we’ll walk through creating a class in X++ that allows you to dynamically update or insert records into a specified table using a map of values.…
In Dynamics 365 Finance and Operations (D365FO), leveraging data contracts with attributes is crucial for defining parameters in the SysOperation framework. However, accessing these attributes dynamically, especially those decorated with custom names using [DataMemberAttribute], can be a challenge. In this article, we’ll explore how to retrieve attribute names dynamically in X++ by utilizing .NET reflection…
In Dynamics 365 Finance and Operations (D365FO), developers often work with data contracts in the context of the SysOperation framework. Sometimes, you might need to dynamically access all the attributes (properties) of a data contract without manually specifying each one. This article will guide you through a method to iterate over all the attributes of…
In Dynamics 365 for Finance and Operations (D365FO), managing data visibility effectively means ensuring the right information is always available, while also accommodating user-specific customizations. A common requirement arises when you need to apply specific filters that override user custom views, ensuring critical business data rules are always enforced. In this blog post, we’ll explore…
To add a range with an OR condition on a filter field in an AOT View in Dynamics 365 Finance and Operations, you can follow these steps: Example: If you need to handle more complex cases with multiple OR conditions across different fields, you may need to use a custom query. In this case, you…
Below is the code to find the current exchange rate of given currencies in X++
Some times fortunately or unfortunately user delete a record from Purchase Order OR Sales Order Forms and it can be drag you in a big problems, Here I am sharing a trick to restore these deleted Order records.When ever a record is deleted from a Form, it sits in the void tables. These orders can…
The DateTimeUtil::toFormattedStr method in X++ is useful for formatting dates according to specific patterns. However, to achieve a specific format like dd/mm/yyyy, you need to use the appropriate date sequence code. In AX 2012 and Dynamics 365 for Finance and Operations, DateTimeUtil::toFormattedStr may not directly support a custom format string like dd/mm/yyyy. Instead, you’ll typically…
Tto set a D365 SysOperation Framework default value
In this blog you’ll learn hoe to perform simple insert and update operations in D365F&O using custom service and test throught Postman and .NET console application : https://medium.com/@arif8h/simple-crud-insert-and-update-operations-in-d365fo-using-custom-service-and-testing-in-postman-70870469785e
If you want to call a function without opening a dialog, you can use the following example. It’s importand to disabled the use of the last value now, because otherwise there will be no dialog when the user opens the function “normally” by using a menu item.
Sometimes an outer join is necessary in a query to enrich the resulting records with additional data but the fields can also have NULL since they come from an outer join and some records may not exist! To solve the issue you can create a computed field in your view and use SQL ISNULL() function Here is…
How can I use insert_recordset command in order to insert to table a column with ‘constant’ value. something like: insert_recordset mytable(mycol1, mycol2, mycol2) select col1, col2, ‘bbbb’ from mytable2; This can be achieved like shown in following code
Nice post that shows how to connect D365FO and Azure blob storage using X++ Post : https://www.linkedin.com/pulse/d365fo-file-based-integration-using-azure-blob-storage-vlad-zhauniak/
Do you want a line number field for your table just like we see the line numbers on SalesLine table on the Sales Order? if so then follow the steps below the achieve this functionality. 1. Drag LineNum EDT to the fields node of your table.2. Create an index on your table and drag the…
Disable retries when you call a batch via code (sysOperation or Runbase) Disable retries in the main method of the batch via code (sysOperation or Runbase)
Retrieves the name of the Application Object Server (AOS) that is responsible for servicing the session.
If you want to check if the code is running either on the batch or locally, call below method. 1. For sysOperation framework: this.isExecutingInBatch().2. RunBase batch: this.isInBatch() both methods will return a boolean.
Create a runnable class and add the below code. On executing the class, code will display the current Environment URL
To publish multiple Data Entities at the same time follow these steps :
If you are updating sales line Qty using x++, use the below code to update lines and transactions related to that line.
Sometimes you might want to remove the BYOD (Bring Your Own Database) connection strings from a Dynamics 365 for Finance and Operations database. This could be, for example, when you’ve copied a database between two environments, as the connection string can’t be decrypted on a different database server and might not be valid for the new environment.…
To determine the version of SQL Server, you can use any of the following methods. Method 1: Connect to the instance of SQL Server, and then run the following query: An example of the output of this query is the following: Method 2: Starting in SQL Server 2008, you can also use the Installed SQL Server Features…
If you include the SysOperationInitializable class in a data contract using the implements command, the method initialize() gets available and can be overwritten. This method can be used to initialize variables within the data contract. However, this method is only called as long as no usage data is found or it is not activated. If…
To disable Retry when a Batch job fails just set “Maximum retries” to ZERO
This post describes best practices to handle Errors in X++: https://markedcode.com/index.php/2022/11/09/x-error-handling/
You can execute a BYOD export using X++ code First create a new Data management Export project name and add your Data entities Then Use this simple runnable class to execute it
I have a string which stores the bufferTable name, now i want to use this string in a select statement. I could use this sample code
The Set class is used for the storage and retrieval of data from a collection in which the values of the elements contained are unique and serve as the key values according to which the data is automatically ordered.You can create a set of primitive data types or complex data types such as a Class,…
I had a scenario where I had to call a new method in one of the fields from Vendor Payment Journal Line.The new method exists in Extension class of Vendor Payment journal.(which is a form method). This has to be called in modified method of the field ‘Ledger Dimension’.The steps are as follows How do…
You can use following code/job to get a bank account name of a customer either from custtransopen or custtable.
Dynamics 365 for Finance and Operations on a local development environment may all of the sudden start reporting problems with the server due to expired certificates. Here you can find the solution to the issue : https://ax.docentric.com/expired-certificates-renewal-in-d365fo/?toolbarclose=yes
1) Create contract class for both outer and inner node. 2) Use FormJsonSerializer::deserializeObject method Step 1 : Create contract class 1 to hold all the values of data node. Note : DataMemberAttribute name should be matched with JSON key name i.e. data, ID Nation Step 2 : Create contract class for outer node. In your case if…
Step 1: From the home screen of D365, go to the system administration workspace. Not from the modules. From the summary, click on “Data management IT”. See below screenshot for guide Step 2: Go to the recurring data jobs and find the required data job, in the enabled field, select “Inactive”:
You can use FormDataSource.displayOption method This method is executed one time for each record before the record is displayed in a form. This is an example on how to change the backcolor of a row grid at Form DataSource level using Extensions
I have a table and I need to retrieve the ID of the Second row. How to achieve that ? By Top 2 I select the two first rows, but I need only the second row Solution : you can use OFFSET and FETCH NEXT NOTE: OFFSET can only be used with ORDER BY clause. It cannot be used on its own.…
Good post that describes how to override Lookup method using Event Handler : https://dynamics365musings.com/override-an-existing-lookup-method-event-handler/
Just something simple to try – you may have tried it already. Right click the Solution in solution explorer, click “clean solution”, this deletes all the compiled and temporary files associated with a solution.
Given the following table in SQL Server What is the best way to write the query that yields the following result (i.e. one that yields the final column – a column containing the minium values out of Col1, Col2, and Col 3 for each row)? Using CROSS APPLY! like shown in below code
This post describes how to renew an SSL certificate on a DEV environment
If you want to share a Form record within AX with others for example within an e-mail you can do it by using a D365FO API. This API let’s you create URL links that point to certain forms and records Below an example method, used in a runnable job, which generates a deep link for…
You can use DateTimeUtil::time(MyDate); Retrieves the number of seconds that have elapsed since midnight as a timeOfDay value from the specified utcdatetime value.
This post shows how to add n working days to a date by using D365FO calendars : https://dotnetxperience.blogspot.com/2016/01/ax-2012-x-add-n-working-days-to-date.html
To remove a substring from another string you can use this custom method
Searches a text string for an occurrence of another string. int strScan(str _text1, str _text2, int _position, int _number) The comparisons aren’t case-sensitive. Values for the _position parameter that are less than 1 are treated as 1. The direction of the scan is controlled by the sign that is specified in the _number parameter. A positive sign indicates that each successive comparison…
This post describes how to iterate all controls of a Form : https://microsoft-dynamics-ax-erp.blogspot.com/2012/07/iterate-through-all-controls-of-form.html
This post describes how to Display the Form With Different Colors For a Particular Control Value or Rows grid cell : https://ashokax.blogspot.com/2017/09/how-to-display-form-with-different.html
Have you ever come across requirements where business often wants easier ways of identifying data records in certain status with specific color coding of the records? For example you might want to see all Approved Sales or Purchase orders marked in “Green Color”, and all Rejected/In Review sales orders marked in Orange/Red color. This was just an example to…
I have a form with 3 datasources – CustPackingSlipJour, PurchLine, WHSLoadTable. I have placed a display method on CustPackingSlipJour form DataSource, but I need access to one field on PurchLine. All I can access is the CustPackingSlipJour which is passed as a parameter _custPackingSlipJour, as standard. How can I retreve value from the second DataSource…
You can use extension to enable or disable a Form Control. In this example I will show how to disable a Form Control button (LineStripNew button) in an extension class od SalesTable Form
I want to get a lookup for all available table names in the system. I know to achieve this on a dialog but now I want a lookup on a stringedit/combobox on a form. The only way I know is to create a table with a field bounded to RefTableId/TableName EDT and override the lookup…
To set a Combobox default value just set the DefaultSelectedItems property like shown below : DefaultSelectedItems = [“Your default value”]
In PowerApps every data source (SharePoint, Dataverse, OneDrive) is under limitation of 500 items by default but you can change this and retrieve up to 2000 which is a maximum value you can set which means you can’t get more that 2000 items To do that just open your app > Settings > General >…
The Default property of the gallery control is the item or record from the data source to be selected in the gallery when the app starts up. In my example I have a button in a gallery which is selected by default whenever I start my APP, but I want to disable this behaviour. To do…
Here is an example of how to use a multi select lookup in a SysOperation class 1. Data contract class: (just showing relevant parameters, there can be other parameters too). Just to note, container type parameter can also be used in place of List. 2. UI Builder Class: This is most important to build a multi…
I have two tables tha are identical (Different names but same fields). The second table is the exact copy of the first When a record in the first table is modified I want the record in the second table to also be modified. To know if the record has been changed I should check every…
You can delete multiple records from a database table by using a delete_from statement. This can be more efficient and faster than deleting one record at a time by using the xRecord .delete method in a loop. If you have overridden the delete method, the system interprets the delete_from statement into code that calls the delete method…
There are several different ways to create records using X++. Insert Types Single Insert Pattern This is an example of a single insert pattern in a loop; open tran, set values, call insert(), close tran, loop Multiple Insert Pattern This is an example of a multi insert pattern with a loop; open tran, set values,…
Most applications today use restful web services to communicate with each other. Sometimes, however, we are required to work with SOAP web services. This post shows hot to use it : https://www.sikich.com/insight/how-to-use-soap-pass-through-with-logic-apps-custom-connector/
Substring Function String Comparison String Deletion Find characters in string String format Length of string Convert string in lower case Convert string in upper case Repetition of string Convert date into string in x++
This is a simple example of how to call external web services from D365FO without using any C# DLL files. Just plain X++ code. As sample External Web Service, I have selected Microsoft Flow. Azure Logic Apps will be similar. Create a test Microsoft Flow Let’s create a simple Microsoft Flow that will be triggered…
It’s easy, you must use this.formRun().design().controlName() syntax like shown below
Sequence of Methods calls while opening the FormForm — init ()Form — Datasource — init ()Form — run ()Form — Datasource — execute Query ()Form — Datasource — active () Sequence of Methods calls while closing the FormForm — canClose ()Form — close () Sequence of Methods calls while creating the record in the FormForm…
Occasionally we will need to change the accessibility of a certain controls/fields on a form in Dynamics AX. This can either be to hide/disable or show/enable the field from the user based on the current record they are on.
If you need to clean up your production orders and their related journals as well as related info, then you’ll want to look at the clean up functionality for production orders. This will delete ended production orders (ProdTable) ended on or before the date you select with business logic and alerts disabled. Next, it will delete…
Dynamics AX provides a framework, which can be used to update production orders to a specific status. In the example, a production order is ended/finished. If you want to update several production orders at the same time, you must invoke the ProdMultiHistoricalCost.insert() method per production order and pass the respective record of ProdTable.
The performance of queries that are used to calculate on-hand inventory is affected by the number of records in the tables that are involved. One way to help improve the performance is to reduce the number of records that the database must consider. This article describes the on-hand entries cleanup job, which deletes unneeded records…
If you have enabled database logs for some time you will have noticed that the amount of data grows very quickly. Maybe the time has come to delete some data, perhaps those older than a certain date. You can do this by running the “Database log cleanup” batch in D365FO under “System Administation”>>”Periodic Tasks”>>”Database” Here…
Use this batch job to maintain the InventDim table by deleting unused inventory dimension combination records that are no longer referenced by any transaction (regardless of whether the transaction is open or closed) or by any master data. You cannot delete an inventory dimension combination record that is still referenced by a transaction, because when…
Reports are useful to organize data into summaries and grouping to quickly visualize the data. Sometimes having additional visual cues can be helpful to zoom on key sections of the report. In this tip, we will look at how to add conditional formatting to a SQL Server Reporting Services SSRS report to make reports even…
There seems to be an issue with the str2num function when what you want is a real value. This matters because it can be used to convert from a string to an int or a real. In order to successfully convert from a string representation of a decimal value to an actual real type on X++, you…