Useful X++ code samples
This repository contains 3 D365FO models:
- XppTools
The DEV prefix is used for all objects.
It contains user X++ tools, with the additional application functionality. Each tool is located in the separate sub-model.
Fields list form is an extended version of the standard Show all fields form with the additional features such as displaying all fields with the extended information, comparing and editing
Full description: Fields list form. Sub-model name: DEVRecordInfo
This utility adds system field name in the standard query filter lookup and in the "Personalize-Add columns" dialog. So you can search the field by Label(as standard) or by AOT name
Full description: Filter by AOT name. Sub-model name: DEVQueryFieldsAOTName
This utility adds additional relation information into Add table join function of the standard Advanced query form(Advanced filter or sort - Joins - Add table join)
Code is based on sukhanchik post on axForum
Sub-model name: DEVSysQueryFormAddRelInfo
Extension for the standard D365FO table browser that allows root navigation and editing for non-development environments.
Test link https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=USMF&mi=DEVSysTableBrowser&tablename=custgroup. A user should be in the group "DEV Editable table browser"
Full description: Editable table browser. Sub-model name: DEVSysTableBrowser
This functionality is intended to help users deal with list of values in query range. With help of this tool you can:
- Copy list of values from, for example, excel and paste it in a range;
- Easily manage values of existed range
Full description: List of Values to Range Sub-model name: DEVListOfValuesToRange
'Execute direct SQL' is a simple form that allows to write and execute direct SQL from the browser on D365FO database.
Full description: Execute direct SQL in D365FO database Sub-model name: DEVSQLExecute
'SQL reports' functionality is a set of forms that allow to define and execute direct SQL reports in the D365FO database. There is a "SQL definition" table that defines the SQL text, a "SQL format" table that defines the output format(e.g. CSV, Excel, etc..) and SQL Report table where the user can run the report and output the result to the selected format.
Sub-model name: DEVSQLReports
Extension for the standard D365FO system that allows saving stack trace data for infolog messages.
Full description: D365FO Infolog call stack Sub-model name: DEVCallStackInfolog
Refresh Data Entities Faster in D365FO.
Full description: How to Refresh Data Entities Faster in D365FO. Sub-model name: DEVDMFTools
Elements that can be shared between different projects
-DEV class
Collection of global methods
DEVDimensionHelper class contains various methods to work with the financial dimensions.
Description: Working with the Financial dimensions
Classes: DEVFileReaderBase, DEVFileReaderCSV and DEVFileReaderExcel - read from CSV and XLSX files
Description: How to read Excel and CSV files in D365FO using X++
Various X++ examples, that can be used to test something or used as a template. Elements can reference to DEVCommon model objects
Form DEVBlockingTest, table DEVBlockingTestTable(to test SQL blocking issues)
Class DEVTutorialCreateLedgerJournal that demonstrates different methods for a ledger journal creation
Create ledger journals in D365FO using X++
Class DEVReadFromFileExampleCreateJournal - sample code to create a ledger journal from Excel file
Classes DEVTutorialBatchSingleThread, DEVTutorialBatchMultipleThreadBase, DEVTutorialBatchMultipleThread that demonstrates how you can convert your existing batch job to multi-threaded.
A simple way to implement a parallel batch processing in X++
Contains report development examples
A sample code to Create a new design for Sales Invoice report in D365FO (https://denistrunin.com/xpptools-reportsalesinvoice/)
Contains "External integration" framework. It includes core module and samples. The External Integration framework provides a standardized approach to developing X++ based integrations. It emphasizes ease of support and expedites the development process.
A sample code for implementing file-based integration in Dynamics 365 FinOps using X++. Create Ledger journals based on periodic import of Excel/CSV files from Azure storage (https://denistrunin.com/xpptools-fileintegledger/). Test files for Demo database here
A sample code to implement recurring file-based integration in D365FO using X++ and DMF (https://denistrunin.com/xpptools-fileintegdmf/).
A sample code to implement Azure Service Bus integration in D365FO using X++ (https://denistrunin.com/xpptools-integservbussalesjson/).
A sample approach how to implement XML based integration by importing purchase orders from Azure File Share in D365FO using X++ (https://denistrunin.com/xpptools-integfilesharexmlpurch/).
- Download the Source code from this GitHub repo into the Temp directory on the DEV VM.
- Copy DEVTools(or DEVGlobal, DEVTutorial) folder to your package folder (C:\AOSService\PackagesLocalDirectory )
- Start Visual Studio and Run compile for the DEVTools folder (Dynamics 365 –Build models.. – Select DEVTools)
- Run database sync - Invoke-D365DbSyncModule -Module "DEVTools"
If you want to contribute - change the objects using Visual Studio in the DEVTools model, copy the changed elements(xml files) back into the Temp folder and create GitHub pull request from this Temp folder.
If you want to rename elements prefix you can use this tool that can change multiple file names - Bulk Rename Utility. (From DEV to YourPrefix). Then run Replace in files in Notepad++ .
Feel free to create issues and PRs 😃