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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Create a SysODataActionAttributer in data entity and then accessing the data entity to cancel the transfer order shipment in D365 FO

(0) ShareShare
ReportReport
Posted on by 60

Hello Team,

I have a requirement where i need to create a SysODataActionAttribute in a data entity inventtransferorderheaderentity and use that SysODataActionAttribute to cancel the transfer order shipment, I checked we already have it for ship and receive, so i took reference from that and created one for cancellation of transfer order, Sharing the code of triger and also the code of InventTransferOrderEntityMapbelow

Code in inventransferorderheaderentity : -

[SysODataActionAttribute('CancelShipment_CAP', true)]

public void CancelShipment_CAP()
{
InventTransferOrderEntityMap inventTransferOrderEntityMap;
InventTransferOrderEntityMap.CancelShipment_CAP();
}

Code in InventTransferOrderEntityMap : -

[ExtensionOf(mapstr(InventTransferOrderEntityMap))]
internal final class InventTransferOrderEntityMap_CAP_Extension
{
public void CancelShipment_CAP()
{
ttsbegin;
InventTransferMultiShipCancel inventTransferMultiShipCancel = InventTransferMultiShipCancel::construct();
inventTransferMultiShipCancel.runUpdate(this.createInventTransferParmTable());
ttscommit;

}

}

After writing this code i am trying to test it using postman to check if my transfer order is getting cancelled or not, I also checked with debugging the values are passing correclty but after that it is throwing an exception of update has been cancelled.

If any one has done the transfer order shipment cancellation through odata then please help me on this, Waiting for a positive response on the same. 

Thanks

Piyush Sharma

I have the same question (0)
  • Martin Dráb Profile Picture
    239,140 Most Valuable Professional on at

    In general, you can use the debugger to find more about what's happening in code. And you may want to test your code in X++ first before trying to call it from outside.

    But I think I see a problem in your code - you never assign any value to inventTransferOrderEntityMap variable.

    By the way, please use Insert > Code (in the rich-formatting view) to paste source code to this forum. It preserves line indentation, to mention only one benefit.

  • piyush02 Profile Picture
    60 on at

    Hello Martin,

    Thanks for your reply, I have tried with assigning the value also previously it didnt worked, It stopped the update and throw an exception.

  • Martin Dráb Profile Picture
    239,140 Most Valuable Professional on at

    Do you agree that your current code can't ever work and trying to run it makes no sense? If so, then we can make some progress. First of all, you must use a shipment, because canceling nothing can't work. Then use the debugger to debug your code. First of all, unsure yourself that your attempt to populate the succeeded.

    If you need our help, tell us more than that you got an exception. Tell us what the error message says and which line of code threw the error. Also, show us the relevant code.

  • piyush02 Profile Picture
    60 on at

    Hi Martin,

    Definitely i have done something wrong that is why i am asking someone, if someone has done the same thing or not, Although thanks for your help

  • Martin Dráb Profile Picture
    239,140 Most Valuable Professional on at

    Your answer didn't make clear to me whether you understand your current bug or not. If you do, go and fix it.

    If you don't, let me repeat that you didn't populate inventTransferOrderEntityMap variable, therefore you current code isn't canceling any shipment. You're calling cancellation on an empty buffer, which must fail.

  • piyush02 Profile Picture
    60 on at

    Hello Martin,

    Thanks for your reply, but the thing mentioned by you is not the problem here, i tried the same by using main method InventTransferMultiShipCancel  instead of runupdate method and it worked

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 689

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 258 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans