Item No. cant rename

dhakshnamoorthydhakshnamoorthy Member Posts: 19
Hi,
While item no. renamaing, i am getting the error message.
The following field must be included in the table's primary key:
Field: "Description"
Table: "Item"

Comments

  • vijay_gvijay_g Member Posts: 884
    Check the primary key of item table. while renaming the item you must give new value for all primary key fields.
  • SogSog Member Posts: 1,023
    Don't modify your Item table's primary key.
    Check any customisation that includes an update of the description field in oninsert/modify/delete/rename trigger.
    Description should not be modified when renaming an item.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • nXqdnXqd Member Posts: 39
    Hi,
    While item no. renamaing, i am getting the error message.
    The following field must be included in the table's primary key:
    Field: "Description"
    Table: "Item"

    You tried changing the primary keys. It's not recommended to do that so firstly you have to know they reason why they have that primary key or ask which one sets it. So discuss if we can remove it or use another way to work with your current task :)
  • gerrykistlergerrykistler Member Posts: 149
    This sounds like you have a field in another table that has a table relationship to the Description field on the Item table without also a link to the No. field so as it looks for links to rename it is trying to do a rename on this field as well as the link is setup as if teh Description field is the primary key.
    Gerry Kistler
    KCP Consultores
  • MammoMammo Member Posts: 107
    It seems that some body has customized the table and primary key of item table. Please remember not to change the primary key of a standard table ever. Try to rename the item in crounus database and see what have you changed wrongly in the item table primary key.

    BR ,
  • gerrykistlergerrykistler Member Posts: 149
    The error received would not be received if the primary key of the item table was changed. The issue in this case is another table with an incorrect table relationship just tied to the Description field with no link to the primary key ("No.") of the item table.
    Gerry Kistler
    KCP Consultores
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Actually this is a bug in Navision. The bug was introduced in Ver 1.1 as a part of the upgrade tool kit from Navision DOS to Financials. The bug was there because of the change in primary key in the Object Designer from Object name to object ID number. The bug is that Navision should not allow this link to compile it should allow lookup only on the primary key.

    For me this bug is very annoying because it was the first bug I ever reported in the Windows version of Navision and it was never fixed. It can be nearly impossible to find, so its a great way to hide a bomb in Navision. Lets say you have developer access to an add-on in a locked range, simply add a flow field in that table and the customer can never rename an item again.

    Gerry is quite right, and has correctly identified the symptoms. To fix it you need either to know what code was written, or you need to export all tables to text and search for a lookup flow field that indexes on Description. It might take five minutes if you know the database, or 4 hours if you don't.
    David Singleton
  • ufukufuk Member Posts: 514
    This sounds like you have a field in another table that has a table relationship to the Description field on the Item table without also a link to the No. field so as it looks for links to rename it is trying to do a rename on this field as well as the link is setup as if teh Description field is the primary key.

    I also think that Gerry is right.

    To find where this problem occurs:
      Create a form or report using Field table Filter RelationTableNo field with 27 Filter RelationFieldNo with 3

    These are the potential fields that may cause this error. Then check if Item No field relation is not supplied in Table Filter area in this table. If it doesn't exist fill it and try renaming again.
    Ufuk Asci
    Pargesoft
  • gerrykistlergerrykistler Member Posts: 149
    Ufuk has identified a great way to find it, just be aware that it is possible you will not find it this way. Only the simple relationships are stored this way in the database - I found this out the hard way by trying to use this exact approach in code to find if a field has a table relationship. If it has any kind of filtering or other complexity in the relationship it will not appear in the Field TableRelationNo or RelationFieldNo and I have yet to find a way to figure this out, other than exporting the objects to text and searching in the text file.
    Gerry Kistler
    KCP Consultores
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Ufuk has identified a great way to find it, just be aware that it is possible you will not find it this way. Only the simple relationships are stored this way in the database - I found this out the hard way by trying to use this exact approach in code to find if a field has a table relationship. If it has any kind of filtering or other complexity in the relationship it will not appear in the Field TableRelationNo or RelationFieldNo and I have yet to find a way to figure this out, other than exporting the objects to text and searching in the text file.

    :thumbsup:

    Yes my experience is the same, finding this error in my experience takes either 5 minutes or 5 hours :mrgreen:
    David Singleton
  • navuser1navuser1 Member Posts: 1,329
    jmxyah5yh2pk.jpg

    I have found that the above "Field X" does not need be in the Primary Key in the NAV 2013 R2 Database but in NAV 2016 it should be in the PK, otherwise It'll not work as per the requirement.
    Now or Never
Sign In or Register to comment.