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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Sales order hold issue...
Finance forum

Sales order hold issue via X++

(0) ShareShare
ReportReport
Posted on by 6,611

Hello there,

I've got the following code below to add a hold onto a sales order. 

ttsBegin;
MCRHoldCodeTrans holdCodeTrans;
holdCodeTrans.InventRefId = _salesId;
holdCodeTrans.MCRHoldCode = 'Pricing';
holdCodeTrans.insert();
ttsCommit;

I've added this code to an extension class in WhsWarehouseRelease. Something must be off as I'm not seeing the hold applied. What I've tried is running the code in a Runnable class and it appears to work there. I may be missing something?

Thank you!

I have the same question (0)
  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    Did you implement this using event handler or using COC ?  Did you check in the debugger , if that method is being called when you execute your process ?

  • bankk Profile Picture
    6,611 on at

    I used CoC, and yes, I did run the debugger. The method is being called, I even see the RecId when the object is built but I can't find the record in the MCRHoldCodeTrans table nor can I see it on the Sales order's "Order hold". I just tried a full model compile and still no luck.

  • bankk Profile Picture
    6,611 on at

    Hello,

    I discovered a method in the stack call with was calling ttsabort under a specific condition. When I created the hold record I'm in that condition. Is there a way to force the insert regardless of the ttsabort call? Thank you.

  • Verified answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    ttsabort will roll back anything that was done inside that transaction. You can't do anything about that.

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans