Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : pJq5dpzxqW2bK1W3F+0R0u
Finance | Project Operations, Human Resources, ...
Suggested answer

X++ code for sales return order line registration for all disposition codes

Like (0) ShareShare
ReportReport
Posted on 26 Mar 2025 10:09:30 by 22
Could you please provide the X++ code for sales return order line registration for all disposition codes in D365 F&O?
Categories:
  • Suggested answer
    Ramesh Kumar Profile Picture
    1,949 on 26 Mar 2025 at 12:06:31
    X++ code for sales return order line registration for all disposition codes
    Hi,
     
    I hope below can help you.
     
    static void SalesReturnOrderRegistration(Args _args)
    {
        SalesReturnTable salesReturnTable;
        SalesReturnLine salesReturnLine;
        InventDispositionCode dispositionCode;
        CustVendDispute custVendDispute;
        DirPartyTable partyTable;
        CustVendGroup custVendGroup;
        CustTable custTable;
        CustVendTrans custVendTrans;
        
        // Create a new Sales Return Order
        ttsBegin;
        salesReturnTable.clear();
        salesReturnTable.initValue();
        salesReturnTable.SalesId = 'SR12345'; // Example Sales Return Order ID
        salesReturnTable.CustAccount = 'CUST001'; // Example Customer Account
        salesReturnTable.save();
        // Fetch all Disposition Codes
        while select * from dispositionCode
        {
            // For each disposition code, create a sales return line
            salesReturnLine.clear();
            salesReturnLine.initValue();
            salesReturnLine.SalesReturnOrder = salesReturnTable.SalesId; // Link line to return order
            salesReturnLine.ItemId = 'ITEM001'; // Example item
            salesReturnLine.QtyReturned = 10; // Example quantity returned
            salesReturnLine.DispositionCode = dispositionCode.DispositionCode;
            salesReturnLine.save();
        }
        ttsCommit;
        info("Sales return order and lines registered for all disposition codes.");
    }
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
  • Martin Dráb Profile Picture
    232,223 Most Valuable Professional on 26 Mar 2025 at 10:46:33
    X++ code for sales return order line registration for all disposition codes
    Moved from Integration, Dataverse, and general topics forum.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,325 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,223 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans
Loading started