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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

What is the standard rule for invoicing a credit note ?

(0) ShareShare
ReportReport
Posted on by 311

Hi guys,

I'm creating credit note through code (X ). While the credit note is created, order type = "Returned order" and has specified RMA number based on Number sequence setup, then when trying to post invoice through code, this time I' always failed but with no error. I also checked that in my parameters, there is no need to specify Return Order Reason.

I'm using this code : 

SalesFormLetter         formLetterObj;
SalesTable              salesTableInv = SalesTable::find(MyTableSales.SalesId);
                        
formLetterObj   = SalesFormLetter::construct(DocumentStatus::Invoice);
formLetterObj.update(salesTableInv);

May I ask, if in standard environment, means no customizations, is there any rule that might prevent me to invoice using this way ? Because I think I don't have customization in that SalesFormLetter Classes, and as far as I know, my created sales order already created correctly. 

Mind to give me some clue of what might happened ? Sorry, but I tried to debug, but my knowledge on this is limited and can't find what is the problem, when it is goes too deep into SalesFormLetter then I get lost, and in then end I got nothing but the SalesTableInv which is supposed to give me the final result gave me Sales status still in "Open Order" which obviously there is not invoice information.

Thanks,

I have the same question (0)
  • Axel Cage Profile Picture
    311 on at

    I'm wondering if I still need to specify DispositionCode and Post Packing skip in X++ as well, before invoicing.

    I tried to give Disposition code in my Returned order line, but it looks it is still cannot post invoice using the same line of code as in my previous thread. I mean it is still not invoiced but there is no error either.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    305,465 Super User 2026 Season 1 on at

    Hi Axel,

    For return orders, the disposition code determines what to do. It would manage if the goods will be returned by the customer or not and if the customer will receive a credit note or a replacement. For that reason, it is mandatory to have the correct disposition codes setup.

    You can read more about this in the documentation: Specify how to dispose of returned items - Supply Chain Management | Dynamics 365 | Microsoft Learn

  • Axel Cage Profile Picture
    311 on at

    Hi Andre,

    Noted, however I did put the Disposition Code in the end, but still no invoice. In fact, if try to post manually, from the UI, so go to AR/Return orders, the particular Returned Order cannot Post Packing Slip, as the lines is empty ->

    pastedimage1669642681510v1.png

    Currently, my sales order is like below : 

    pastedimage1669642823748v2.png

    Thanks,

  • Axel Cage Profile Picture
    311 on at

    It looks like the Return Status Line have to be "Registered". Then if I Post Invoice manual through the UI, the line appears and I can successfully invoice it.

    Question, how the code looks like to make the Return Status Line to be "Registered" so then It can be continue to Invoice with code ?

    Since if I put the value to be "Registered" on the first time when Sales Line create process, it is go back to "Expected" when Sales Order creation completed.

    Thanks,

  • Suggested answer
    Axel Cage Profile Picture
    311 on at

    I think I found the right class that make the status turn back, which is this class : SalesLineType_ReturnItem, which then I'm created CoC to make it "Registered" when create Sales Line.

    This finally able to post invoice as well, with the code on my first thread.

    Resolved. Thanks

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April 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 671

#2
André Arnaud de Calavon Profile Picture

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

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 589 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans