Integrating Dynamics AX and Shipping Carriers

Integrating Dynamics AX and Shipping Carriers

Integrating Dynamics AX and Shipping Carriers can help your business manage tracking numbers, quickly generate and print mailing labels, decrease the overall time spent preparing and shipping orders to your customers. Your business comes into play by Integrating Dynamics AX and Shipping Carriers. Shipping carriers can be integrated with your Dynamics software, saving valuable time, sharing important information, and increasing efficiency. Microsoft ERP System that is Microsoft Dynamics AX provides the interface to integrate with this Shipping software.  So when you have integrated with this shipping carrier and done all setups which are required, then create a sales order and generate packing slips. This sales order is being automatically forwarded to shipping software. When the tracking number has been generated, this shipping carrier forwards the tracking number to Microsoft Dynamics AX System, so that you can easily track the status of delivery of sales order.

In this write-up I will concentrate on the steps that I followed for Integrating Dynamics AX and Shipping Carriers – FedEx

We will start with Setups that are required in AX for Integration with shipping carriers. Then we will take a brief about FedEx Ship Manager Application that is how to create ODBC connection for mapping of AX database that of FedEx database.

I followed these steps for this exercise:

  1. Configure the Carrier Company: In the Inventory and Warehouse Management >> Setup >> Shipping Carrier >> Carrier Company form, entered FedEx as Carrier and tracking URL provided by FedEx in tracking number URL field. In the same form. In account tab of same form, Click add and then fill Account Code as FedEx and the Carrier Company as FedEx and the carrier account number provided by FedEx.
  2. Take care to enable live mode checkbox in the form: Inventory and Warehouse Management >> Setup >> Shipping Carrier >> Carrier Interface. If you are working in the test mode, then also enable Test mode Checkbox.
  3. We have to specify the Return Address. This return address will get printed on packing slips and Invoices. To specify return address. Go to Inventory management >> Setup >> Inventory and warehouse management parameters. In the General tab, in Return to field, we can either select Company or Warehouse or Site. When we will Specify Company, Legal Entity address will be used as Return address. When warehouse is specified, it will take the address of warehouse from which shipment would be send. If site is specified, then address of site from which shipment would be sent would be used as return address. I had used Company in Return to field.
  4. Setup Miscellaneous Charges Code for Shipping Carrier: You can use existing miscellaneous charges codes or create new ones to use for shipping charges that are transferred from the shipping carrier software by going to Account Receivable >>Setup>>Charges>>Charges Code. I had used the existing ones.
  5. Setting Mode of delivery: We can define the Modes Of delivery by going to Sales and marketing >> Setup >> Distribution >> Modes of delivery. I had created new Mode of delivery, with selecting Service type as ground as per my requirement. Select Carrier Id from dropdown, If not created earlier (which was the case with me), then it can be created by right clicking and then click on view details. I had defined three modes of delivery, it can be defined as per the need.
  6. We had to setup terms of delivery, so that this term of delivery can be assigned in sales order, on the basis of it is decided which type of shipping charges has to add as miscellaneous charges. To do this, Go to Sales and marketing >> Setup >> Distribution >> Terms of delivery. New line has to be created, I had created with the name DT1 and in the freight charge terms, I had used “N-A third party collect. You can select other than it from dropdown as per the need of yours.

Setup to be done in Customer:

I had filled the terms of delivery and modes of delivery in Customer form. If you also want to setup this, then Go to Accounts receivable >> Common>>Customers >> All customers. Go to Address fast tab, make sure that Delivery address is entered with Zip Code.

Then in the same form go to delivery fast tab. Enter the delivery terms and Mode of delivery. Also fill Carrier Account Number.

FedEx Ship Manager Application:

This was the part which was somewhat complicated for me and I had done some R&D work for it. Then come to conclusion, that In FedEx Ship Manager, we have to do ODBC connection with AX database. Please refer this link for Connection, http://help.acctivate.com/articles/12320/.

Once ODBC Connection has been done, you have to Map AX fields with FedEx fields.

Shipping Carrier Interface uses this table of AX :

  1. ShipCarrierShippingRequest: ShipCarrierShippingRequest holds the sales order information that is shown in the Carrier transaction information form. This is the main table that the shipping carrier will map to. Each packing slip/sales order combination will have one record in this table.
  2. ShipCarrierStaging: It receives information from the shipping carrier software. This table contains text and numeric fields that contain the order number, packing slip ID, tracking number and charges. The fields which are used in this table for receiving shipping information are SalesiD,PackingSlipId,PackageId,ShipDate,Weight,Publishedrate,Shipping Charge, Handling Charge:

Once all Setup has been done, I made Sales Order, Confirm it and made packing slip of it. After it Opened FedEx Ship Manager, Started batch to import orders as shown below:

Integrating Dynamics AX and Shipping Carriers

In above screen I checked the purge hold file record and Start batch checkboxes and then click start.

If Sales Order are perfect with all the required details by FedEx, Then Sales Order will be found in Shipping List (Domestic/International), if anything is missing the order can be seen in hold file, you have to rectify errors to Generate Tracking number.  In my case all details were perfect, SO it was added to domestic list.

Integrating Dynamics AX and Shipping Carriers

Then Again I went to AX and viewed tracking number by going to that sales order. Then Selecting packing slip Journal and go to order tracking tab. I found that Tracking Number get updated.

Note: Weight and dimensions are not sent to FedEx Ship Manager, You have to do Customizations for it through Code or through SQL Trigger. I have created a Customized table for Dimensions Entry and Used that Customized table(named as dev_packingslipdimension)  in the form of Sales Order Packing Slip  for Entering dimensions .I have Created  following triggers:

1. After update Trigger on SalesShippingStat table as below:

Create TRIGGER [dbo].[dev_salesshippingstatupdate] ON [dbo].[SALESSHIPPINGSTAT] After update AS
BEGIN
declare @count int
declare @salesid varchar(100)
declare @origsalesid varchar(100)
declare @packingslipid varchar(100)
declare @dataareaid varchar(5)
set @packingslipid=(select top 1 inserted.packingslipid from inserted order by recid desc)
set @dataareaid=(select top 1 inserted.dataareaid from inserted order by recid desc)
set @count=(select count( distinct origsalesid) from CustPackingsliptrans where CustPackingsliptrans.packingslipid= @packingslipid
and CustPackingsliptrans.dataareaid=@dataareaid)
set @salesid=(select top 1 inserted.salesid from inserted order by recid desc)
set @origsalesid=(select top 1 inserted.origsalesid from inserted order by recid desc)
if exists(select * from dev_packingslipdimension
where (salesid=@salesid or salesid=@origsalesid) and isnull(dev_packingslipdimension.packingslipid,'')='' and dev_packingslipdimension.dataareaid=@dataareaid)
begin
update dev_packingslipdimension
set packingslipid=@packingslipid
where (salesid=@salesid or salesid=@origsalesid) and isnull(dev_packingslipdimension.packingslipid,'')='' and dev_packingslipdimension.dataareaid=@dataareaid
update SHIPCARRIERShippingRequest
set width=(select top 1 width from dev_packingslipdimension where packingslipid=@packingslipid
and dataareaid=@dataareaid order by recid desc),
height=(select top 1 height from dev_packingslipdimension where packingslipid=@packingslipid
and dataareaid=@dataareaid order by recid desc),
length=(select top 1 length from dev_packingslipdimension where packingslipid=@packingslipid
and dataareaid=@dataareaid order by recid desc)
where SHIPCARRIERShippingRequest.packingslipid=@packingslipid
and SHIPCARRIERShippingRequest.dataareaid=@dataareaid
end
if exists(select * from SHIPCARRIERShippingRequest join inserted on SHIPCARRIERShippingRequest.Packingslipid=inserted.Packingslipid and SHIPCARRIERShippingRequest.dataareaid=inserted.dataareaid
-- where isnull(inserted.packingslipid,'')!='' and inserted.salesid!=inserted.origsalesid)
where inserted.packingslipid = @packingslipid
and inserted.salesid!=inserted.origsalesid)
begin
update SHIPCARRIERShippingRequest
set weight=((select (sum(isnull(salesshippingstat.grossweight,0))/@count) from salesshippingstat join inserted on salesshippingstat.packingslipid=@packingslipid and
salesshippingstat.dataareaid=inserted.dataareaid))
where SHIPCARRIERShippingRequest.packingslipid=@packingslipid
and SHIPCARRIERShippingRequest.dataareaid=@dataareaid
end
end

2. After Insert  Trigger on SHIPCARRIERSHIPPINGREQUEST table as below:

create TRIGGER [dbo].[dev_ShipCarrierShippingInsTrig] ON [dbo].[SHIPCARRIERSHIPPINGREQUEST] After INSERT AS
BEGIN
declare @packingslipid varchar(100)
declare @recid bigint
declare @dataareaid varchar(5)
set @recid=(select recid from inserted)
set @dataareaid=(select dataareaid from inserted)
if exists(select * from Salesshippingstat join inserted on Salesshippingstat.SALESID=inserted.SALESID where Salesshippingstat.SalesID=inserted.SALESID and
Salesshippingstat.dataareaid=inserted.DATAAREAID )
begin
update SHIPCARRIERShippingRequest
set WEIGHT=
(select top 1 isnull(GROSSWEIGHT,0) from Salesshippingstat join inserted on Salesshippingstat.SALESID=inserted.SALESID where Salesshippingstat.SalesID=inserted.SALESID and
Salesshippingstat.dataareaid=inserted.DATAAREAID order by Salesshippingstat.recId desc )
from SHIPCARRIERShippingRequest join inserted on
SHIPCARRIERShippingRequest.Recid=inserted.recid and
SHIPCARRIERShippingRequest.SALESID=inserted.SALESID
where SHIPCARRIERShippingRequest.SALESID=inserted.SALESID
and SHIPCARRIERShippingRequest.dataareaid=inserted.DATAAREAID
end
end

The following two tabs change content below.
Mukesh Jethwani
I am Technology Enthusiast. Possess interpersonal skills and proven abilities to resolve complex software issues. Technical expertise includes strong hands-on technical skills in Microsoft Dynamics AX IDE MorphX (Designers and Development Tools), programming language X++, SSRS,Power BI,MSSQL Database.
Mukesh Jethwani

Latest posts by Mukesh Jethwani (see all)

One thought on “Integrating Dynamics AX and Shipping Carriers

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>