Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How to cancel transfer order throw x++

(0) ShareShare
ReportReport
Posted on by 1,021

Hi experts,

How can I cancel the transfer order throw x++? I try this class InventTransferMultiShipCancel but I can't use it well.

  • Community member Profile Picture
    24 on at
    How to cancel transfer order throw x++
    have you all achieved this? i need to select multiple transfer order and cancel in one go through x++. please suggest
  • piyush02 Profile Picture
    60 on at
    RE: How to cancel transfer order throw x++

    Did it worked, Not worked for me

  • source258147 Profile Picture
    1,021 on at
    RE: How to cancel transfer order throw x++

    I create this method try it

    public static void cancelTO(InventTransferId _transferId)
        {
            InventTransferJour          inventTransferJour;
            InventTransferParmTable     transferParmTable;
            InventTransferTable         transferTable;
    
            select firstonly1 inventTransferJour where inventTransferJour.TransferId == _transferId && inventTransferJour.UpdateType == InventTransferUpdateType::Shipment;
            
            if(inventTransferJour)
            {
                transferParmTable.initParmDefault();
                transferParmTable.ParmId = RunBaseMultiParm::getSysParmId();
                transferParmTable.UpdateType = InventTransferUpdateType::Shipment;
                transferParmTable.TransferId = inventTransferJour.TransferId;
                transferParmTable.VoucherShipmentId = inventTransferJour.VoucherId;
                transferParmTable.CanceledShipmentJournalRecId = inventTransferJour.RecId;
    
                transferParmTable.write();
    
                //cancelling the Transfer order
                InventTransferMultiShipCancel inventTransferMultiShipCancel;
                inventTransferMultiShipCancel = InventTransferMultiShipCancel::construct();
                inventTransferMultiShipCancel.runUpdate(transferParmTable);
    
                
            }
            
            
        }

  • mohamedheikal Profile Picture
    5 on at
    RE: How to cancel transfer order throw x++

    Hello,

    did it work? i have the same problem.

  • source258147 Profile Picture
    1,021 on at
    RE: How to cancel transfer order throw x++

    Can i get help please

  • source258147 Profile Picture
    1,021 on at
    RE: How to cancel transfer order throw x++

    Hi Nuno Maia

    Please check the debug point from the system and from me

    this args from the system. I click on cancel transfer order then add break point

    pastedimage1664364753924v2.png

    this from the job i create it 

    pastedimage1664364682174v1.png

    Job Code

    class XXXCancelTransferOrder_Job
    {
        public static void main(Args _args)
        {
            InventTransferJour      inventTransferJour = InventTransferJour::find("TO-000057","TOV-054487");
            FormRun     formRun;
    
            _args.record(inventTransferJour);
            _args.menuItemName("InventTransferShipCancel");
            _args.menuItemType(MenuItemType::Action);
            _args.parm(formStr(InventTransferJour));
            _args.name(formStr(InventTransferJour));
            formRun = classFactory.formRunClass(_args);
            _args.caller(formRun);
    
    
            XXXInventTransferMultiShipCancel::main(_args);
        }
    }
     

  • Suggested answer
    nunomaia Profile Picture
    11 Moderator on at
    RE: How to cancel transfer order throw x++

    Can you make a simples simulation.

    Add a breakpoint to InventTransferMultiShipCancel

    1. Cancel Transfer Order from D365 Menu, can confirm parameters that are being executed.

    2. Compare those parameters, to the ones you are passing to class

  • source258147 Profile Picture
    1,021 on at
    RE: How to cancel transfer order throw x++

    Hi GirishS

    Thanks for your help. I know this feature and it's already enabled and we use it. but I need to cancel the transfer order throw x++.

    I want to use it in API.

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: How to cancel transfer order throw x++

    Hi Source,

    I don't think this can help your issue. But you can make use of it.

    Instead of x++ code, Microsoft has given feature for canceling transfer order. Please go through the below link. 

    https://exploredynamics365.home.blog/2020/11/07/transfer-order-cancellation-new-feature-in-microsoft-dynamics-365-finance-and-operations/

    Thanks,

    Girish S.

  • source258147 Profile Picture
    1,021 on at
    RE: How to cancel transfer order throw x++

    any help please

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,265 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,927 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans