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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

Map Ship Date and Receipt date in Transfer Order Form

(0) ShareShare
ReportReport
Posted on by 30

Hi all

I've a scenario where I want to show same ship date and receive date on Transfer Order Form as it is on the Transfer Order History form.

I've written a class to do this, but the values are not changing 

Here is my code:

 [FormEventHandler(formStr(InventTransferOrders), FormEventType::Activated)]
    public static void InventTransferOrders_OnActivated(xFormRun sender, FormEventArgs e)
    {
        FormDataSource      InventTransferTable_ds = sender.dataSource(formDataSourceStr(InventTransferOrders, InventTransferTable));
        InventTransferTable inventTransferTable = InventTransferTable_ds.cursor();
        
        
        InventTransferJour  inventTransferJour;
        FormRun             forme;
        FormDateControl     ShipDate, receiptdate, transferId;
       
        

        ShipDate    = sender.form().design().control("LineViewHeader_ShipDate")    as FormDateControl;
        receiptdate = sender.form().design().control("LineViewHeader_ReceiveDate") as FormDateControl;
        
        select inventTransferTable
           join inventTransferJour
            where inventTransferJour.TransferId ==  inventTransferTable.TransferId;
        {

            if(inventTransferJour.UpdateType == InventTransferUpdateType::Shipment)
            {

                inventTransferTable.ShipDate     = inventTransferJour.TransDate;
                
            }
            
            if(inventTransferJour.UpdateType == InventTransferUpdateType::Receive)
            {

                inventTransferTable.ReceiveDate  = inventTransferJour.TransDate;
           
            }

            inventTransferTable.update();
          

        }
    }

Can someone please help me

Kind regards.

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi,

    Have you tried writing display methods for these values?

  • André Arnaud de Calavon Profile Picture
    300,904 Super User 2025 Season 2 on at

    Moved to the Dynamics 365 Supply Chain Management forum.

  • AhsanZia Profile Picture
    30 on at

    No Gunjan

    Guide me please

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi,

    You can follow this link for an example. You can use the existing query to display the dates in new controls as per your requirement

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi,

    Were you able to get this working?

  • AhsanZia Profile Picture
    30 on at

    No

    I'm trying finding the correct event handler to use in my current code

    I want the shipment and receive dates to come from Transfer Order History form, which are obviously the actual shipment and receive dates

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ahsan,

    You are looking to just display these values in the transfer order history form. Correct? Or are you looking to create new fields and insert these values there?

  • AhsanZia Profile Picture
    30 on at

    I'm looking to get the Ship Date and Receive Date values from Transfer Order History form and show these value in the Transfer Order Header's Ship date and Receive date.

    Which means I want the Transfer Orders to always get the Ship date and Receive date from the Transfer Order History's Ship date and Receive date

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ahsan,

    Since you the history table is created on posting the transfer order, you should write an extension of the InventTransferJour\insert method using CoC. This will update the dates when posting the order.

    [ExtensionOf(tableStr(InventTransferJour))]
    final public class InventTransferJour_Extension
    {
        public void insert()
        {
            InventTransferTable inventTransferTable;
    
            next insert();
    
            ttsbegin;
    
            select forupdate inventTransferTable           
                where inventTransferTable.TransferId ==  this.TransferId;
    
            if(this.UpdateType == InventTransferUpdateType::Shipment)
            {
                inventTransferTable.ShipDate     = this.TransDate;                
            }
            else if (this.UpdateType == InventTransferUpdateType::Receive)
            {
                inventTransferTable.ReceiveDate  = this.TransDate;           
            }
    
            inventTransferTable.update();
    
            ttscommit;
      
        }
    
    }

    You can write a simple job to update the existing orders. 

    It is not recommended that you update the table every time you open a form. Hence you must take care of this using table methods only.

  • AhsanZia Profile Picture
    30 on at

    Thank u so much Gunjan

    This is the right answer and did the job!!

    Kind Regards,

    Ahsan Zia

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Siv Sagar Profile Picture

Siv Sagar 283 Super User 2025 Season 2

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 213 Super User 2025 Season 2

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 152 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans