public Name getParentPositionWorkerName(HcmPositionRecId _positionRecId) HcmWorker hcmWorker; HcmPositionWorkerAssignment workerAssignment; HcmPositionHierarchy hcmPositionHierarchy; utcdatetime now = DateTimeUtil::getSystemDateTime(); // 1. Find the parent position in the hierarchy // 2. Join to the assignment table to find who sits in that parent position // 3. Join to the worker table to get the name select firstonly * from hcmWorker join workerAssignment where workerAssignment.Worker == hcmWorker.RecId && workerAssignment.ValidFrom <= now && workerAssignment.ValidTo >= now join hcmPositionHierarchy where hcmPositionHierarchy.ParentPosition == workerAssignment.Position && hcmPositionHierarchy.Position == _positionRecId && hcmPositionHierarchy.ValidFrom <= now && hcmPositionHierarchy.ValidTo >= now; return hcmWorker.name(); } |
Inside Microsoft Dynamics AX
Friday, 16 January 2026
Get Parent Position Worker Name from Current Worker Position | D365FO X++
Monday, 12 January 2026
To understand AI, think in layers
🚀 Many people think AI progress is about bigger models or new buzzwords.
But that’s not the real shift.
To understand AI, think in layers:
🔹 Rules-based AI followed instructions written by humans.
No thinking. No learning.
🔹 Deep Learning learned patterns from data.
It didn’t know things — it recognized them.
🔹 Generative AI creates content.
Text, images, code — impressive, but mostly reactive.
You ask → it responds.
🔹 Agentic AI is different.
It doesn’t just answer.
It plans steps, chooses tools, and takes action to reach a goal.
That’s why this matters 👇
The real breakthrough isn’t what AI can say.
It’s what AI can do next without being told.
So instead of asking:
❌ “Is this the newest model?”
Start asking:
✅ “Can this AI think ahead and act on its own?”
That shift — from response to action — is where the next wave of AI is coming from.
Wednesday, 3 July 2024
How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO
Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to retrieve the value of every single field in the "Totals" form, as shown in the image below.
Note: Pre-requisite to get all the values is customer invoice (CustomerInvoiceTable).
Instantiating
CustFreeInvoiceCalcTotals class:
CustFreeInvoiceCalcTotals
custFreeInvoiceCalcTotals = new CustFreeInvoiceCalcTotals(custInvoiceTable);
Calculating Totals:
custFreeInvoiceCalcTotals.calc();
1- Get a Credit limit from the
custFreeInvoiceCalcTotals class:
CustCreditMaxMST creditMax;
creditMax = custFreeInvoiceCalcTotals.custFreeInvoiceCreditMax();
2- Get a Credit Available from
the custFreeInvoiceCalcTotals class:
CustCreditFreeValueMST freeValue;
freeValue = custFreeInvoiceCalcTotals.custFreeInvoiceFreeValue();
3- Get a Line Discount from the
custFreeInvoiceCalcTotals class:
SalesSumLineDiscAmount lineDisc;
lineDisc = custFreeInvoiceCalcTotals.custFreeInvoiceLineDisc();
4- Get a Subtotal Amount from the
custFreeInvoiceCalcTotals class:
AmountCur sumLines;
sumLines = custFreeInvoiceCalcTotals.custFreeInvoiceInvoiceAmountGTE();
5- Get a Total Discount from the
custFreeInvoiceCalcTotals class:
SalesEndDiscAmount endDisc;
endDisc = custFreeInvoiceCalcTotals.custFreeInvoiceEndDisc();
6- Get a Total Charges from the
custFreeInvoiceCalcTotals class:
MarkupSumSales sumMarkup;
sumMarkup =
custFreeInvoiceCalcTotals.custFreeInvoiceMarkup();
7- Get a Sales Tax from the custFreeInvoiceCalcTotals class:
TaxAmountCur sumTax;
sumTax = custFreeInvoiceCalcTotals.custFreeInvoiceTaxTotal();
8- Get a Round-Off from the custFreeInvoiceCalcTotals class:
RoundOff invoiceRoundOff;
invoiceRoundOff =
abs(custFreeInvoiceCalcTotals.custFreeInvoiceRoundOff());
9- Get an Invoice Amount from the custFreeInvoiceCalcTotals class:
AmountCur invoiceAmount;
invoiceAmount =
custFreeInvoiceCalcTotals.custFreeInvoiceInvoiceAmount();
10- Get a Cash Discount from the custFreeInvoiceCalcTotals class:
CustCashDiscAmount cashDisc;
cashDisc = custFreeInvoiceCalcTotals.custFreeInvoiceCashDisc();
11- Get an Exchange rate from the CustInvoiceTable table1-:
Exchrate exchRate;
exchRate = CustInvoiceTable.displayExchRateForReportingCurrency();
12- Get a Currency from the custFreeInvoiceCalcTotals class:
CustCurrencyCode currency;
currency =
custFreeInvoiceCalcTotals.custFreeInvoiceCurrency();
Result:
Wednesday, 22 May 2024
How to Resolve DVT Script Issues When Applying Quality Updates in LCS for D365FO
Recently, while applying Quality updates 39, I encountered an error stating "DVT script for service mode: AOSService on machine." Upon examining the error logs, I found the description: "ERROR: System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
After some research, I discovered a solution:
First: Abort the current process in the Lifecycle Services (LCS) as this option is only available for environments in the Deployed state. Second: Then, navigate to the Environment details page, click Maintain, and select Rotate secrets. Choose Rotate the SSL certificates and confirm the action.
This simple solution resolved my problem.
Friday, 10 May 2024
How to Convert Images to Base64 Strings in D365 Finance & Operations
In this blog, I will discuss how to convert an image into a base64 encoded string in Dynamics 365 Finance and Operations (D365FO). Fortunately, D365FO provides a built-in class, BinData, equipped with a method that returns a base64 encoded string. Below, I have provided a block of code that demonstrates how to accomplish this task.
Explanation of the Source Code:
Initialize and Declare the
BinDataClass: First, create an instance of theBinDataclass, which will be used to handle the binary data of the image.- Retrieve the Image from a Worker: Obtain the image file associated with a worker. This image is typically stored as a binary file or blob in the database.
Pass the Image to
setData()Method: Load the image data into theBinDatainstance using thesetData()method. This method prepares the image data for conversion by handling it as binary data.Convert to Base64 Encoded String: Use the
base64Encode()method of theBinDataclass to convert the binary data of the image into a base64 encoded string. This string can then be used in HTML, stored, or transmitted as needed.
Tuesday, 7 May 2024
Creating and Consuming a .Net Library for SFTP Connection in Dynamics 365 Finance & Operations (Part-1)
Introduction
In today's interconnected systems, secure file transfers are critical. SFTP (Secure File Transfer Protocol), which utilizes SSH (Secure Shell) for enhanced security, is commonly used for this purpose. In this blog, I will guide you through creating a .Net library to establish an SFTP connection and demonstrate how to integrate this library into a Dynamics 365 Finance & Operations (D365FO) environment.
Step 1: Create a .Net Class Library
First, start by creating a .Net class library. This library will be responsible for handling the SFTP connection.
Step 2: Add Necessary NuGet Packages
For handling SFTP operations, add the following packages to your project:
Renci.SshNet– Provides the basic functionality for SFTP connections.Microsoft.Bcl.AsyncInterfaces– Required for async support in .Net Standard 2.0 projects.
Note: You can install these packages via NuGet Package Manager or using the Package Manager Console.
Step 3: Implement SFTP Connection Logic
Implement the SFTP connection logic within your library. Create methods for connecting to the SFTP server, as well as for listing directories, downloading, and moving files.
Use the following code snippet for Getting directory, files and moves them after executing in the related folder.
Step 4: Build and Deploy the Library
After implementing the necessary functionality in your .Net library, build the project. Navigate to the bin\Debug or bin\Release folder, depending on your build configuration, and locate the generated DLLs. Select the highlighted DLLs from .Net project as shown below.
Step 5: Integrate with Dynamics 365 FO
To use your new library within Dynamics 365 FO, you need to import the DLLs into your project. Copy the DLLs from your .Net project's output folder to the AOSService->PackageLocalDirectory->Your Model Bin folder of your AX extension. This makes the library available to your AX project.
Step 6: Consume the Library in D365FO
Now, you can invoke the methods from your SFTP library within your D365FO codebase. You might need to handle any threading considerations, depending on how D365FO consumes external libraries.
Conclusion
By following these steps, you have created a reusable .Net library capable of handling SFTP operations and integrated it within Dynamics 365 FO, enhancing your application’s ability to interact securely with external systems through file transfers. This integration not only secures data transmission but also extends the functionality of your D365FO environment efficiently.
Get Parent Position Worker Name from Current Worker Position | D365FO X++
In this blog, we explore how to fetch the Parent Position Worker from a Current Worker Position in D365FO. The solution revolves around c...



