Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Error missing return reason code when creating credit note / return order

(0) ShareShare
ReportReport
Posted on by 66

Hi,

One of our customers is using D365 Finance and Operations, and they recently updated to Service Update 10.0.28.
Since then they are getting errors saying that the "return reason code" is missing when creating credit notes from sales order, or when creating a return order.

Scenario:

In Accounts Receivable > Setup > Accounts receivable parameters > General > Reason code requirements the customer has actived the parameter "Require reasons for return orders"

0825.pastedimage1659608763123v1.png

- Go to Accounts Receivable > All Sales Orders
- Create a new sales order of type "Sales Order
- Click on menu Sell > Credit Note
- Select an invoice to create a credit note for
-Click OK

(FYI... the same error occurs when you try to create a return order from the "All return orders" form)


Now they keep getting the following error:
2273.pastedimage1659609234467v2.png

After debugging the cause of this error seemed to be that apparently Microsoft has added an extra validation in the form method validateCloseOK( ) method on the SalesCopying form, that goes to check if the   unbound string control "EditReturnReasonCode" (which is inside a hidden Group "ReturnReasonCode") has a value, and if it doesn't it will always result in the error above if the "Require reasons for return orders" parameter is active... (see screenshot below)

8267.pastedimage1659609391264v3.png


Now it seems to me that this code should ONLY be executed for return orders that were created from the Customer Service module, because if you look at the the init( ) method of the SalesCopying form
you can see that the said control is ONLY visible AND mandatory when coming from the Customer Service module...

5807.pastedimage1659610015056v4.png
and further down in the code
3750.pastedimage1659610204809v5.png

In the validateCloseOK( ) method no distinction is made between credit notes / return orders created in Accounts Receivable module and return orders created in Customer Service module when performing this extra check. But it SHOULD, in my opinion...


The workaround around is easy enough, if you make the group "ReturnReasonCode" visible by creating an extension of the form the user can enter a random value to satisfy the validation criteria (since the entered value is not used or saved on the SalesTable as far as I can tell, unless you actually created a return order from the Customer Service module).

Or you can create a CoC form extension class where you temporarily enter a dummy value in the "EditReturnReasonCode" control, execute the default validation code, and afterwards clear the dummy value again + setting the variable shouldOpenReturnTableForm = false again (but this approach, even if it's temporary,  is even less clean than just making the EditReasonCode group visible).

But it seems (at least to me) that Microsoft dropped the ball here...


Has anyone experienced the same issue ?
Do you guys agree that this is an actual bug, or am I missing something with regard to setup ?

Any input is greatly appreciated !

  • Syed Bilal Shakeel Profile Picture
    10 on at
    RE: Error missing return reason code when creating credit note / return order

    I also faced this problem after updating the version, There is hotfix avaliable for this please search the issue from LCS and you will be able to find the hotfix for it. It worked fine for me on prod

  • Verified answer
    nunomaia Profile Picture
    11 Moderator on at
    RE: Error missing return reason code when creating credit note / return order

    Check if KB725339 solves your issue 

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

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

#2
Martin Dráb Profile Picture

Martin Dráb 232,044 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans