web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Implementing Delivery reminder functionality through Data entity

(0) ShareShare
ReportReport
Posted on by

Hi,

We have a requirement such that when a purchase order line is cancelled at a legacy application the same Purchase order number line must get cancelled in D365. We tried setting the PurchLine.PurchStatus = PurchStatus::Canceled through Data entity using event handlers at PurchLine onupdating.

But when we go for PO receive and putaway for the same Purchase order line it still allows us to get the line for work creation. While when we perform the Delivery reminder functionality available at PurchTable form it also cancels the line and the line is not available any more for PO Receive and putaway.

Expected behavior: When we cancel the purchase order line through data entity the same purchase order line should not be available for PO receive and putaway and throw error saying "Product cannot be received. Please contact your supervisor."

Actual: We are able to get the line for PO Receive and putaway for work creation.

Please find the screen shot attached with the post showing the behavior of the form when cancellation is done through Delivery reminder functionality.POLineCancellationFunctionality.PNG

*This post is locked for comments

  • Sohaib Cheema Profile Picture
    on at
    RE: Implementing Delivery reminder functionality through Data entity

    Just updating, the status of Line of purchase order through data entity is not the job well done. AX does its own things on cancelation of an order line, such as working against the inventory transaction that was sitting as on-order in inventory area. Cancelling remaining quantity and so on.

    You may want to do any of two things

    1. Craete OData Action for your entity

      Or

    2. Use a custom web service (any available or create new one)

  • Saurav Profile Picture
    on at
    RE: Implementing Delivery reminder functionality through Data entity

    We are already using Odata  for our data entity.

    What we have done is On-Updating event of PurchLine we have written the following code. When the Legacy system sends the cancellation request for a particular purchase order line, our data entity will cancel the same purchase order line and update the inventory through the below mentioned code.

    /// <summary>

       /// The <c>.</c> class is the developed for the WSS Purchase Order Data entity onUpdating event <c>.</c> class.

       /// </summary>

       /// <param name="sender">

       ///

       /// </param>

       /// <param name="e">

       ///

       /// </param>

       [DataEventHandler(tableStr(PurchLine), DataEventType::Updating)]

       public static void PurchLine_onUpdating(Common sender, DataEventArgs e)

       {

           PurchLine purchLineLoc = sender as PurchLine;

           WHSLoadLine whsLoadLineLoc;

           //     RecId PurchLineRecId;

           WSSPurchaseOrder  wSSPurchaseOrder = new WSSPurchaseOrder();

           if(purchLineLoc.WSSPurchLineStatus)

           {

               if(purchLineLoc.WSSPurchLineStatus == "@WSSLabel:WSS19" || purchLineLoc.WSSPurchLineStatus == "@WSSLabel:WSS20" || purchLineLoc.WSSPurchLineStatus == "@WSSLabel:WSS21")

               {

                   purchLineLoc.PurchStatus = PurchStatus::Backorder;

               }

               else if (purchLineLoc.WSSPurchLineStatus == "@SYS3012" ||  purchLineLoc.WSSPurchLineStatus == "@WSSLabel:WSS22")

               {

                   purchLineLoc.PurchStatus    =   PurchStatus::Canceled;

                   purchLineLoc.RemainInventPhysical = 0;

                   purchLineLoc.RemainPurchPhysical = 0;

                   purchLineLoc.PdsCWQty = 0;

                   InventMovement::bufferSetTransQtyUnit(purchLineLoc);

                   InventMovement::bufferSetRemainQty(purchLineLoc);

                   ttsbegin;

                   delete_from whsLoadLineLoc

                       where whsLoadLineLoc.InventTransId  ==  purchLineLoc.InventTransId;

                   ttscommit;

               }

           }

           if (purchLineLoc.PurchStatus != PurchStatus::Canceled)

           {

               WSSPurchaseOrder.updatePurchTable(purchLineLoc.PurchId);

           }

       }

    However, when we perform the PO Receive putaway after this, we are still able to use that item for work order creation

    Please suggest , how can we achieve this

    Regards,

    Sourav

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans