Posts

Showing posts from December, 2024

Cancel Post packing slip from all Shipments in D365 F&O through X++

 Hi Viewers, To Cancel Post packing slip for Shipments. we first have to cancel the Packing slip, reverse the shipment, and then reopen the container. To Cancel Post packing slip:   WHSLoadTableCustPackingSlipJour loadCustJour;  CustPackingSlipJour             custJour;    WHSLoadTable        loadTable;        loadTable = whsshipmenttable::find(ShipmentID).whsLoadTable();      while select custJour          where custJour.Qty          exists join loadCustJour              where loadCustJour.WHSLoadTableLoadId       == loadTable.LoadId              &&    loadCustJour.WHSLoadTableDataAreaId   == loadTable.DataAreaId              &&    loadCustJour.CustPa...

In ax D365F&O post packing slip from shipment through code x++.

 Hi viewers, To post the packing slip for the sales order from the shipment, we first have to close the containers, confirm the shipment, and then post the packing slip. these steps can be handled either through code or manually updated from the form by the user. I am sharing the code to update accordingly. To Close the container.  public void closeContainer()  {       WHSContainerTable               containerTable;      WHSCloseContainerProfile        closeContainerProfile;      WHSShipmentTable                shipmentTable;                containerTable = WHSContainerTable::findByContainerId(PackageDetailsTable.ContainerId);          closeContainerProfile = WHSCloseContainerProfile::find(containerTable.CloseContainerProfileId);         ...

Call third party API from D365F&O through code x++, with Authentication key and user login

 Hi viewers, Please check the code to call third-party API from D365 F&O through code x++. For authentication sample code:   public str getKey()   {       System.Net.HttpWebRequest request;       System.IO.Stream stream;       System.Exception sysEx;       str responseBody;       container con;       request = System.Net.WebRequest::Create(" URL") as System.Net.HttpWebRequest;       request.Method = 'post';       request.ContentType = 'application/json';       str jsonstring = strFmt('%1%2%3%4%5%6%7','{','"login"',':','"info@****.com",','"password":','"******"','}');       var utf8 = System.Text.Encoding::get_UTF8();       var byteArrayPayload = utf8.GetBytes(jsonstring);       using (System.IO.Stream dataStream = request.GetRequestStream())       {        ...