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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to cancel transfer order throw x++

(0) ShareShare
ReportReport
Posted on by 1,025

Hi experts,

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

I have the same question (0)
  • Suggested answer
    nunomaia Profile Picture
    25 Moderator on at

    In main method of class InventTransferMultiShipCancel  you have the way to cancel. You just need to pass the record to cancel in args parameter.

    Just the replicate main code to your needs. You can also execute main method if you need the confirmation message 

                InventTransferMultiShipCancel InventTransferMultiShipCancel = InventTransferMultiShipCancel::construct();
                ttsbegin;
                RunBaseMultiParm::initFromForm(InventTransferMultiShipCancel, _args);
                InventTransferMultiShipCancel.runOperation();
                ttscommit;
                InventTransferMultiShipCancel.runReports();
                InventTransferMultiShipCancel.refreshTransferOrderForm(_args);

  • source258147 Profile Picture
    1,025 on at

    Hi Nuno Maia

    I did that before but not work for me

    class CancelTransferOrder_Job
    {
    public static void main(Args _args)
    {
        InventTransferJour inventTransferJour = InventTransferJour::find("TO-001","TOV-001");
    
        _args.record(inventTransferJour);
    
        InventTransferMultiShipCancel InventTransferMultiShipCancel = InventTransferMultiShipCancel::construct();
        
        ttsbegin;
        RunBaseMultiParm::initFromForm(InventTransferMultiShipCancel, _args);
        InventTransferMultiShipCancel.runOperation();
        ttscommit;
        
        InventTransferMultiShipCancel.runReports();
        //InventTransferMultiShipCancel.refreshTransferOrderForm(_args);
    }
    
    }

  • source258147 Profile Picture
    1,025 on at

    Can I get more support please

  • Komi Siabi Profile Picture
    13,120 Most Valuable Professional on at

    When you debug, what are you getting ?

  • source258147 Profile Picture
    1,025 on at

    Hi Komi Siabi

    I didn't get any errors the job is completed and the Transfer order did not cancelled

  • source258147 Profile Picture
    1,025 on at

    any help please

  • GirishS Profile Picture
    27,827 Moderator on at

    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,025 on at

    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.

  • Suggested answer
    nunomaia Profile Picture
    25 Moderator on at

    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,025 on at

    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);
        }
    }
     

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 423 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans