June 30, 2025

Custom web service in D365FO - Part-II


Hi Folks,

In Part 1, we covered the foundational elements of creating custom services in Dynamics 365 Finance and Operations (D365FO), including the architecture, request/response contracts, and service class. In this second part, we’ll explore how to implement business logictest your service, and handle errors effectively to ensure your service is robust and production ready. Its important you take a look to my previous post as I will carry on example from that post.

 Custom web service in D365FO - Part-I

Implementing Business Logic

Once your service class is set up, the next step is to implement meaningful business logic. This could involve querying tables, performing validations, or updating records. Here's an enhanced version of the processMsg() method with actual logic:


Testing the Service

Once deployed, you can test your service using tools like Postman or SoapUI. Here's how to do it with Postman:

  1. Set the URL:

https://<your-environment>.cloudax.dynamics.com/api/services/TheAxaptaInterface/TheAxaptaService/processMsg

  1. Set Headers:
    • Content-Type: application/json
    • Authorization: Bearer token (use OAuth 2.0)
  2. Request Body (JSON):
  3. Send Request and inspect the response.

Error Handling and Logging

Robust error handling is essential for production-grade services. Here are some best practices:

  • Use try-catch blocks to handle both X++ and CLR exceptions.
  • Log errors using the EventLog or custom logging frameworks.
  • Return meaningful messages in the response contract to help consumers understand what went wrong.
  • Avoid exposing sensitive data in debug messages.

Example of logging:

EventLog::add(EventLogCategory::Application, EventLogLevel::Error, "CustomServiceError", response.parmDebugMessage());


-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

June 23, 2025

[Solved] Unable to connect with Dev box Error code: 0xd07

Hi folks,

Recently, I ran into a frustrating issue while trying to connect to my development box. Out of the blue, the system refused to let me in and threw an error that blocked my access. If you've ever been in the middle of a project and suddenly lost access to your VM, you know how disruptive this can be.

After some trial and error, I found a solution that worked—and I’m sharing it here in case it helps someone else facing the same problem.

Error message: 

Remote Desktop Connection

As a security precaution, the user account has been locked because there were too many logon attempts or password change attempts. Wait a while before trying again, or contact your system administrator or technical support.

Error code: 0xd07
Extended error code: 0x0
Timestamp (UTC): 06/11/25 09:48:38 AM






Solution: 

Step 1: Try a Full Stop and Start (Not a Restart)
First, I tried restarting the VM from the Azure portal, but that didn’t help. What worked was stopping the VM completely and then starting it again. This seems to reset some internal state that a simple restart doesn’t touch.

Step 2: Use an Alternate User to Regain Access
If the stop/start method doesn’t work, the issue might be with the admin account being locked. In that case, you can log in using an alternate user account. You can find this user’s credentials on the LCS (Lifecycle Services) page under Environment Details.

Here’s how to proceed:

  • Log in to the VM using the alternate user.
  • Open the Run dialog (press Win + R) and type: lusrmgr.msc
  • This opens the Local Users and Groups management console.
  • Find the admin user, right-click on it, and select Properties.
  • Uncheck the option that says “Account is locked out” (or similar).
  • Apply the changes and try logging in again with the admin account.


Other Recommendations: 
1. Add the other user in Admin group once your admin account is enabled, this will give you more control on this when needed. 
2. You can also install Account Lockout Status for further troubleshooting on why account is getting locked
3. While you are unlocking Admin account, also set 'Password never expire' option this will disable the option itself of account getting locked. 


-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

June 09, 2025

QuickFix: Unable to do PITR from Prod to sandbox

If you are getting below error while trying to do a PITR from Production to one of your Sandbox environment, and getting below or similar error message


Error message:

Sorry, unable to start this operation. Please try again or contact support if the issue persists.
Session ID 3820sdfgsdff-a2c9-4345dsfgc-96e4-f1easdfg3d28sdf712
Search timestamp 2025-06-09T21:03:07.468Z
23.011.115.942-b25fa8ee-stable at ProdDemoTest


Possible Reason: 

You are trying to restore very recent backup which might be still in progess, for example, you at 10:05 AM , you are trying to restore a Production backup of 10:00 AM. 


Solution: 

Try to choose at least two hours earlier time to do PITR. 


-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

June 04, 2025

Configuring MT940 Bank Reconciliation in D365FO Using Electronic Reporting

Introduction

In any organization the bank reconciliation is a critical process in financial operations, ensuring that your internal records match your bank's statements. In the latest version Microsoft Dynamics 365 Finance and Operations (D365FO), the Advanced Bank Reconciliation can be done via Elecroic reporting (ER), this feature allows you to automate this process using formats like MT940, BAI2, and ISO20022. This post I will walk you through setting up MT940 reconciliation using Electronic Reporting (ER).
Before we begin, please make sure you have System Administrator or Electronic Reporting Developer Role.
Let’s start configuration now, 

Import MT940 ER Configuration

1. Navigate to Workspaces > Electronic Reporting.
2. Click on Configuration Providers and select Microsoft.
3. Open the Global repository (or Dataverse if configured).
4. Search for and import the following configurations (Always import the latest version of each configuration)
   - Advanced bank reconciliation model
   - MT940 format mapping
   - MT940 format (TXT)

Set Up Bank Statement Format

1. Go to Cash and Bank Management > Setup > Advanced bank reconciliation setup > Bank statement format.
2. Click New and fill in:
   - Statement format: MT940
   - Name: MT940 Format
   - Generic electronic import format:  Checked
   - Import format configuration: Select the imported MT940 ER format

Configure Bank Account for Reconciliation

1. Navigate to Cash and Bank Management > Bank accounts.
2. Select the bank account you want to configure.
3. Under the Reconciliation tab:
   - Set Advanced bank reconciliation to Yes (You cannot undo this step, so choose the right record)
   - Choose the Statement format as MT940

Test the Import Process
1. Go to Cash and Bank Management > Bank statement reconciliation > Bank statements.
2. Click Import statement.
3. In the dialog:
   - Select the Bank account
   - Choose Statement format: MT940
   - Upload your MT940 sample file
   - Click OK

If configured correctly, the transactions will be imported and ready for reconciliation.

Troubleshooting Tips
- Transformation Errors: Ensure the MT940 file matches the expected structure. You can validate using the ER designer.
- No Transactions Imported: Check if the bank account number in the file matches the one in D365FO.
- Post-DB Refresh: Re-import ER configurations and re-link them in the import project.