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 :
Dynamics 365 Community / Forums / Finance forum / Registering return ord...
Finance forum

Registering return order lines X++

(0) ShareShare
ReportReport
Posted on by 177

Hello,

I have written code to automatically register the inventory lines on a return order. When I do this process functionally through the UI, I go to the line, and hit Update line> registration. Then when I go through that whole process the line status turns to Registered and the Receipt status turns to registered. Additionally, the button to Post packing slip is activated.

When I try to accomplish this same thing in code, the Receipt status on the line turns to registered, but the line status stays as Open, and the packing slip button is still disabled. This is the code I'm using, and it works perfectly for registering sales lines. Does anyone have any experience registering return order lines so that the status changes and I can proceed with posting the packing slip?

 InventTrans       inventTrans;
        InventDim         inventDim;
        InventMovement movement = InventMovement::construct(_salesLine);
        InventUpd_Registered registered;
        InventDimParm dimParm;

        inventTrans = InventTrans::findTransId(_salesLine.InventTransId);
        inventDim = InventDim::find(_returnsTmp.inventDimId);
        dimParm.initFromInventDim(InventDim);

        registered	= InventUpd_Registered::newParameters(movement, InventDim, dimParm, InventDim, dimParm, _returnsTmp.ReturnQuantity);

        registered.updateNow();
  • Verified answer
    Zen_Raj Profile Picture
    177 on at

    Fixed by making sure the header is set to Open, the QtyOrdered and SalesQty are set to the return quantity, and the line is set to Registered

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

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