A user wishes to update the Item group for a released product.
They right-click on the Item group field and selects the Record Info menu item.
In the Record information form they click the Fill Utility button.
We get the following error:
(C)\Forms\SysFillUtility\Methods\initializeMainQuery – line 61
(C)\Forms\SysFillUtility\Methods\init – line 53
In this case, the error was caused by the fact that the primary field of the table (the table that the field belongs to that they wanted to change) is not of type string.
What did we do to resolve this?
1. First we found what the tableid was by doing some x++ debugging. Put a breakpoint, for example on method at the top of the stack in line 61. When the code stops, after closing the stack trace window, in this method you can find there a variable called tableid. Note the value.
2 Several methods can be used to then convert the tableid to a table name, see http://msdn.microsoft.com/en-us/library/aa498759(v=AX.50).aspx for more information on how to use tablename2id x++ function.
3 In the AOT, we located our table
4. and found the PrimaryIndex property
5. In our case the value of this property was set to SurrogateKey and that means RecId.
6. So In general, to fix this, we found what the field type is and added a line to the ‘InitializeMainQuery’ method of the SysFillUtillity form.
To fix our error, the following if clause was added in Forms\ SysFillUtillity\ InitializeMainQuery:
else if (mainTablePrimaryField)
This programming example is for illustration purposes only. Microsoft disclaims all warranties and conditions with regard to use of the programming example for other purposes. Microsoft shall not, at any time, be liable for any special, direct, indirect or consequential damages, whether in an action of contract, negligence or other action arising out of or in connection with the use or performance of the programming example. Nothing herein should be construed as constituting any kind of warranty.
Other related articles:
|–author:||Erco van Harn|
|–reviewer:||Mansour Yahya Mohamad Mansour|