I recently worked on an issue where the order of products in the product grid of a custom Quote report and Order report were out of sync with the actual Quote Product grid and actual Order Product grid in Dynamics CRM.
To troubleshoot, there first needed to be verification that the custom Quote report was using the correct field. The quotedetail.sequencenumber field of the quote detail record contains the sequence (position) value for the products displayed in the product sub grid. This field is automatically updated when a user presses the up or down arrows (see image below) located above the product sub grid. The report stays in sync by using this field to keep the position changes made to the quote product grid.
The sequencenumber field was being used correctly in the report. Next, a SQL query in SQL Server Management Studio was constructed to display specific fields for a join between the quote and quotedetail views. Using this query with the quote number from a test quote in CRM, I was able to observe the current value of the quote detail sequence number while pressing the up and down arrows on the product grid.
After pushing the up and down arrows a few times, re-executing the query after each arrow press, I was able to see that the sequence number was not being updated by CRM.
While using Fiddler4, there were no errors being displayed and there were no client to server communications (updates). Working with MS support, we needed to determine whether error messages were being suppressed. If so, the error messages needed to be enabled for us to see the generated error message. To enable error messages navigate to Settings->Administration->Privacy Preferences:
The user had the “Never send an error report to Microsoft” selected. I selected the “Ask the user for permission…” option and saved the preferences. Shortly after changing this setting an error popped up when I used the browser back button while on a quote form. The error looked like this:
Next, Microsoft requested to view the error details. There were a lot of details, but the line that had value was “Unable to get property 'controls' of undefined or null reference.”
Ultimately, using this information and CRM server traces, Microsoft support was able to determine the reason why the sequence number was not being updated --- the Out of the Box (OOTB) Total Amount field (totalamount) had been removed from the Quote form and replaced by a custom total amount field. As soon as the OOTB Total Amount field was added and the change was published to the quote form, the client to server communications began. I could then see that the sequence number was being updated in the database whenever the up or down arrows changed the product position in the quote detail sub grid.
Product sequence in Quote form product grid:
Product sequence on custom Quote report when the OOTB Total Amount field is missing from the quote form – CRM and the report sequence do not match.
The Order form and the Quote form were missing the OOTB Total Amount field so the sequence number updates were not working either. The customer is using custom fields for the amount calculations, so the OOTB Total Amount field was removed as “no longer necessary”. There is no Microsoft documentation stating that the OOTB Total amount field must stay on the Quote and Order forms and the user is permitted to remove this field at any time.
To fix this issue:
Add the Out of the Box (OOTB) Total Amount field (totalamount) back onto the Quote or Order forms, lock it on the form, make the field invisible (if you are not going to use it) and then publish the changes.