Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article describes how to create a new transportation management engine in Dynamics 365 Supply Chain Management.
Transportation management (TMS) engines define the logic that is used to generate and process transportation rates in Transportation management. Supply Chain Management provides several different engine types that calculate different parameters, such as rates, transit times, and the number of zones that will be crossed during transit. This article explains how to use the Microsoft Visual Studio development environment together with Supply Chain Management development tools to create and deploy a new TMS engine, and then how to set up the engine in Operations. For more information about the engines, see Transportation management engines.
This section explains how to create a class library that has a TMS engine implementation, and how to reference it from a Supply Chain Management model.
To deploy your new engines, you must have a model that will contain the engines. On the Dynamics 365 > Model Management menu, select Create model to create a new model. On the first page of the Create model wizard, name the model TMSEngines.
On the next page, select Create new package.
On the next page, select the ApplicationSuite model to reference. (The ApplicationPlatform model is preselected.)
On the next page, select Finish to confirm the creation of a new model.
In a new solution, create a new Supply Chain Management project, and name it TMSThirdParty
. In the project properties, set the project's model to TMSEngines.
Add a new C# class library to your solution, and name it ThirdPartyTMSEngines
.
In the ThirdPartyTMSEngines
project, add references to Supply Chain Management–specific assemblies:
Application assemblies that enable X++ types to be referenced. These assemblies can be found in the following locations. [Packages root] is the path of the location where all the deployed assemblies are placed, such as C:\Packages.
[Packages root]\ApplicationPlatform\bin\Dynamics.AX.ApplicationPlatform.dll
[Packages root]\ApplicationFoundation\bin\Dynamics.AX.ApplicationFoundation.dll
[Packages root]\ApplicationSuite\bin\Dynamics.AX.ApplicationSuite.dll
Framework assemblies that enable access to data, LINQ, and auxiliary functions. All these assembles can be found in [Packages root]\bin.
Microsoft.Dynamics.ApplicationPlatform.Environment.dll
Microsoft.Dynamics.AX.Data.Core.dll
Microsoft.Dynamics.AX.Framework.Linq.Data.AdoNet.dll
Microsoft.Dynamics.AX.Framework.Linq.Data.dll
Microsoft.Dynamics.AX.Framework.Linq.Data.Interface.dll
Microsoft.Dynamics.AX.Framework.Linq.Data.Msil.dll
Microsoft.Dynamics.AX.Server.Core.dll
Microsoft.Dynamics.AX.Xpp.AxShared.dll
Microsoft.Dynamics.AX.Xpp.Support.dll
The core TMS assembly (which contains engines) and the TMS base assembly (which contains helpers, constants, data transfer class definitions, and so on). These assemblies can be found in the following locations.
[Packages root]\ApplicationSuite\bin\Microsoft.Dynamics.AX.Tms.dll
[Packages root]\ApplicationSuite\bin\Microsoft.Dynamics.AX.Tms.Base.dll
Rename the C# class that is automatically generated in the ThirdPartyTMSEngines
project to SampleRatingEngine.
Implement the engine. Because we're creating a rate engine in this example, we inherit from the base class for rate engines. The base class implements most of the rate engine interface (TMSFwkIRateEngine). We just have to implement the rate method. To keep this example simple, we'll make this method register a hard-coded rate of 100. You can create engines that implement any of the engine interfaces, such as TMSFwkIAccessorialEngine. All the engine interfaces are defined in X++.
namespace ThirdPartyTMSEngines
{
using Dynamics.AX.Application;
using Microsoft.Dynamics.Ax.Tms.Base.Data;
using Microsoft.Dynamics.Ax.Tms.Base.Utility;
using Microsoft.Dynamics.Ax.Tms.Bll;
using System.Xml.Linq;
public class SampleRatingEngine : BaseRateEngine
{
public override RatingDto rate(TmsTransactionFacade transactionFacade, XElement shipment, TMSRateMasterCode rateMasterCode)
{
XElement re = shipment.RetrieveOrCreateRatingEntity(this.RatingDto);
re.AddRate(TmsRateType.Rate, 100);
return this.RatingDto;
}
}
}
Build the solution.
Add a new reference to the TMSThirdParty
project. The reference should point to the ThirdPartyTMSEngines
project. When you've finished, your solution should look like this.
Build the solution. Verify that the new library appears in the References node in Application Explorer.
One way to deploy third-party TMS engines is through a deployment package. To deploy the engine as a package, follow these steps.
In Visual Studio, go to Extensions > Dynamics 365 > Deploy > Create Deployment Package and create a deployment package for the new model you created as described in Create a new TMS engine.
In Dynamics Lifecycle Services, go to Asset Library > Software deployable package. Select Add to add the deployment package you created to LCS.
After the validation completes, go to Environments > {Your Environment ID} > Maintain > Apply updates, select the deployable package, and apply.
Note
If the system warns you that you don't have permission to deploy packages on Lifecycle Services, please contact your LCS administrator for support.
This section explains how to set up Supply Chain Management to use a TMS engine, and shows how the new engine that we have created is used in rate shopping. The example in this section uses the USMF demo data company.
Create a new engine as described in Create a new TMS engine.
Build your solution.
Deploy the TMS engine DLL file through a deployment package, as described in Deploy the TMS engine as a package.
In Supply Chain Management, on the Rate engines page, create a new rating engine. The engine should point to the engine assembly produced by building the engine class library and the engine class that you implemented.
Create a shipping carrier that uses the Sample rate engine. Because our engine doesn't use any data, you don’t have to assign a rate master.
On the Rate route workbench page, select Rate shop. You should see a rate of 100.00 from SampleCarrier, as shown in the following screenshot. In this example, we're rate shopping for a route from warehouse 24 to customer US-004. However, but because the rate is hard-coded, you'll always see a rate of 100.00.
ThirdPartyTMSEngines
project, you must deploy through a deployment package. Otherwise, you might run using a stale assembly.ThirdPartyTMSEngines
assembly so that the assembly can’t be updated. In this case, restart the w3svc process.For more information, download the following white paper (written to support AX2012, but still partially applies for Dynamics 365 Supply Chain Management)
Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayTraining
Module
Manage transportation management in Dynamics 365 Supply Chain Management - Training
Efficiently manage inbound and outbound orders with vendor and routing solutions using Dynamics 365 Supply Chain Management.
Certification
Design and configure Dynamics 365 Supply chain Management and related tools.
Documentation
Transportation management engines - Supply Chain Management | Dynamics 365
Transportation management engines define the logic that is used to generate and process transportation rates in Transportation management.
Set up shipping carriers - Supply Chain Management | Dynamics 365
Learn how to set up a shipping carrier and define details such as service, shipment mode, transportation tender, transportation constraints, and shipping rate.
Transportation management overview - Supply Chain Management | Dynamics 365
Access an overview of the transportation management functionality in Supply Chain Management, including a table outlining information for various scenarios.