Search This Blog
March 17, 2025
Update admin user in Dev box
January 24, 2025
Custom web service in D365FO - Part-I
Introduction
Custom services in Dynamics 365 Finance and Operations (D365FO) allow you to expose custom business logic and data to external systems. This first part of the blog post will walk you through the basics of creating and consuming custom services in D365FO. Custom services are used to expose X++ business logic to external systems via SOAP or RESTful endpoints. They are ideal for scenarios where you need to implement complex business processes that are not covered by standard services.
In later posts, we will discuss some complex scenarios and best practices around web services.
Architecture
Service Request Contract
The service contract defines the operations that the service will expose. This is done by creating a new class with the [DataContractAttribute]
and [DataMemberAttribute]
attributes. There must be two contract classes: one for the request message and another for the response message. (We will cover this in detail in future posts).
Example:
[DataContractAttribute]
public class TheAxaptaRequestContract
{
private boolean isShipped;
private String255 dataAreaId;
private String255 storeNumber;
private String255 trackingNumber1;
[DataMember("TrackingNumber1")]
public String255 parmTrackingNumber1(String255 _trackingNumber1 = trackingNumber1)
{
trackingNumber1 = _trackingNumber1;
return trackingNumber1;
}
[DataMember("IsShipped")]
public boolean parmIsShipped(boolean _isShipped = isShipped)
{
isShipped = _isShipped;
return isShipped;
}
[DataMember("DataareaId")]
public String255 parmdataAreaId(String255 _dataAreaId = dataAreaId)
{
dataAreaId = _dataAreaId;
return dataAreaId;
}
[DataMember("StoreId")]
public String255 parmStoreNumber(String255 _storeNumber = storeNumber)
{
storeNumber = _storeNumber;
return storeNumber;
}
}
Service Response Contract
Example:
[DataContractAttribute]
public class TheAxaptaResponseContract
{
private boolean success;
private str errorMessage;
private str debugMessage;
private System.String salesOrder;
[DataMember("Message")]
public str parmMessage(str _value = errorMessage)
{
if (!prmIsDefault(_value))
{
errorMessage = _value;
}
return errorMessage;
}
[DataMember("Success")]
public Boolean parmSuccess(Boolean _value = success)
{
if (!prmIsDefault(_value))
{
success = _value;
}
return success;
}
[DataMember("DebugMessage")]
public str parmDebugMessage(str _value = debugMessage)
{
if (!prmIsDefault(_value))
{
debugMessage = _value;
}
return debugMessage;
}
}
Service Class
This is the class where the actual business operation executes. It takes the request message from the respective contract class and processes it to create a response message. Create a new class to implement the service. This class should extend the SysOperationServiceBase
class and include the business logic for the service operations.
Example:
public class TheAxaptaService extends SysOperationServiceBase
{
TheAxaptaResponseContract response = new TheAxaptaResponseContract ();
[AifCollectionType('salesOrder', Types::Class, classStr(TheAxaptaRequestContract)),
AifCollectionType('return', Types::Class, classStr(TheAxaptaResponseContract ))]
public processMsg()
{
TheAxaptaRequestContract request;
// Now you can access the parm methods of the request class to get different values from the request
Str StoreId = request.paramStoreNumber();
response.parmSuccess(True);
response.parmMessage("Message read");
}
}
Register the Service
Register the service in the AOT (Application Object Tree) by creating a new service node. Set the class and method properties to point to your service implementation.
- In the AOT, right-click Services and select New Service. (e.g. TheAxaptaInterface)
- Set the Class property to your service class (e.g., TheAxaptaService).
- Set the Method property to the service method (e.g., processMsg).
Deploy the Service
Deploy the service to make it available for consumption. This can be done by right-clicking the service node in the AOT and selecting Deploy Service Group.
Consume the Service
December 16, 2024
Error while converting .bak file to backpac
Can you please try below ways
Option 1: (Remove extension from source database)
SqlPackage.exe /a:export /ssn:localhost /sdn:AxDB /tf:J:\theaxapta\AxDB.bacpac /p:CommandTimeout=1200 /p:VerifyFullTextDocumentTypesSupported=false /SourceTrustServerCertificate:True
Option 2: (Along with that use user name and password)
SqlPackage.exe /a:export /ssn:localhost /sdn:AxDB /su:axdbadmin /sp:XXXX /tf:J:\Capgemini\AxDB.bacpac /p:CommandTimeout=1200 /p:VerifyFullTextDocumentTypesSupported=false /SourceTrustServerCertificate:True
October 29, 2024
[Solved] Service update 10.0.40 The specified module 'C:\Program Files\Microsoft Security Client\MpProvider
September 03, 2024
Installing Planning Optimization Add ins in D365FO
- Only works on an LCS-enabled high-availability environment (tier 2 or higher). OneBox environments are not supported.
- Ensure your system is set up for Power Platform integration.
- Your Microsoft Entra account must have a Supply Chain Management license. No extra license is needed for Planning Optimization, but a Supply Chain Management license is required.
- Sign in to your Power Platform environment with an account that has administrator privileges and Read-Write access.
- All the steps should be followed by one admin user.
Next screen, Here you will see two template available, I would recommend to use with dual write so you still have option to use more features of it while doing this setup once. Here is quick difference in both
August 21, 2024
How to connect cloud hosted environment with Data verse / Power Platform
August 02, 2024
QuickFix: Issue with CAR report generation (The source for referenced module '####' is missing from the model store. Please specify the -packagesRoot parameter to instead use binary metadata for referenced modules.)
Issue and Solution:
The issue was I used the cmd car parameter path in quotations.
July 19, 2024
[Solved] The container will need to be recreated with the new table metadata in order to be unpacked correctly.
July 16, 2024
How to Install 'Globalization Solution for Microsoft Dynamics 365 Finance' for ER reporting
i. Dataverseii. Operation resource
July 10, 2024
Thank you Everyone!!!
(I will try be just human👼to write this post, no AI 🤐 . Because this is very special to me and close to my heart👐)
Hello Everyone,
I writing this 'Thank you' note for each of you for your love and support thought the year.
I started my Microsoft MVP journey back in year 2013, with one mind set, 'Help others, help yourself'. Today I remarked my 11th consecutive year for this Award. I’ve had the privilege of connecting with brilliant minds, sharing knowledge, and contributing to the growth of technical communities. Together, we’ve shaped the future of Microsoft products and services.
THANK YOU!!! My family, Friends, Mentors and communities for your love and support.
Looking forward to 'Help people, Help myself' for another a year (And many more). Let’s continue inspiring, learning, and making a difference in the our communities.
If you want to know more about MVP Program : https://mvp.microsoft.com/
My Blog post: https://www.theaxapta.com/
YouTube channel: https://www.youtube.com/@TheAxapta
Twitter: https://x.com/d47447
LinkedIn DUG group: https://www.linkedin.com/groups/13988044/
June 17, 2024
Error 1067: The Process terminated unexpectedly.
June 07, 2024
[Solved] Dynamics 365FO DB restore error Line 1 The permission 'KILL DATABASE CONNECTION' is not supported in this version of SQL Server.
Error Details: The error message for BacPac DB restore is as follows:
Dynamics 365FO DB restore error Line 1 The permission ‘KILL DATABASE CONNECTION’ is not supported in this version of SQL Server. Alternatively, use the server level ‘ALTER ANY CONNECTION’ permission.
Step 1: Navigate to the folder where your BACPAC file is saved and change the file extension from .bacpac to .zip.
Step 2: Open the zip file and copy the model.xml file to a different location. Open the copied file in a text editor such as Notepad, VS Code, or Visual Studio. (Avoid editing the file directly in the zip folder or the original file).
Step 5: Change the file extension of the zip file back to .bacpac (reverse of Step 1).
Step 6: Go to the downloaded SQLPackage folder and execute the following command:
SqlPackage.exe /a:import /sf:J:\MSSQL_BACKUP\PreProdDB.bacpac /tsn:localhost /tdn:AxDB_PreProd2005 /p:CommandTimeout=1200 /TargetUser:"axdbadmin" /TargetPassword:"<DbPassword>" /TargetTrustServerCertificate:True /mfp:"ModelCopy.xml
DB import should be successful this time.