Link to home
Start Free TrialLog in
Avatar of tturney
tturney

asked on

dictTable.primaryKeyField() for InventTable returns null

Hello,
  In out Axapta 3.0 environment, we frequently create InventTable items and then rename (change the itemId number) into a different sequence.  Recently, the SysRecordInfo form won't allow use to rename and Item.  When we trace into the code, the dictTable.PrimaryKeyField() functions returns null.  We have ItemId setup as the primary key field and SQL shows that it is.  What else could be causing this problem?

Tom T.
Avatar of quale-kaizen
quale-kaizen
Flag of Bulgaria image

1) Is this behavior  consistent for all items?

2) Create new job in AX and run this code. What is the output? It should be an integer larger than 0.
static void Job1(Args _args)
{
    SysDictTable dictTable = new SysDictTable(tableNum(InventTable));
    ;
    info(int2str(dictTable.primaryKeyField()));
}

Open in new window

Avatar of tturney
tturney

ASKER

The result of the job is 0.  SQL still shows InventTable with a primary key of the ItemId field.  In Axapta, InventTable also shows ItemId alone in the primary index.  Any item I select to try and rename in the items table doesn't show that as an option.  The CustTable still does allow renaming.
The problem is in the InventTable in AX.

Go to AX -> AOD -> Data dictionary -> InventTable -> Fields -> ItemId
and make sure the "Extendended Data Type" property is set to "ItemId".
Avatar of tturney

ASKER

quale-kaizen,

  Thanks for your replies.  The ItemId field is still set to the extended data type of ItemId.  I changed it, and then changed it back.  I then resynced and compiled the table.  Unfortunatly, the problem still exists.
ASKER CERTIFIED SOLUTION
Avatar of quale-kaizen
quale-kaizen
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tturney

ASKER

quale-kaizen,

  It turned out it was a customization on the InventTable that was a relation to another table.  Once I removed that, it worked fine.  Thanks for your advice and help.

Tom T.