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"
- 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:
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)
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...
and further down in the code
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 !