web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

BC14 to 17.2 - The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

(0) ShareShare
ReportReport
Posted on by 20

Hi,

I'm doing a intermediate upg from BC14 to 17.2 on prem. 

In task 12 of the MS Docs, when I sync my customizations, i'm having these exceptions. None of these table objects are customized. These primary key exceptions are new to me. Can someone help ? 

Note important :

In the previous task of the MS Docs, it is written to publish extensions in a specific order and in this order Customization extensions are set before Application Extension. This seems to be error because Customization extensions require Application Extension as it has it in dependencies. So I reverted this order. So in Task 11 I published extensions in this order : 

Second version of the table migration extension, which is the empty version with the migration.json file.
Microsoft System Application
Microsoft Base Application
Application extension.
Customization extensions.

Might this be te cause of my these issues ? 

Table VAT Reg. No. Srv. Template :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.
Table VAT Reg. No. Srv. Template :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.
Table VAT Registration Log Details :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.
Table VAT Registration Log Details :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.
Table BOM Ledger Entry :: The table 'BOM Ledger Entry' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Setup Checklist Line :: The table 'Setup Checklist Line' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Setup Checklist Comment :: The table 'Setup Checklist Comment' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Application Area Line :: The table 'Application Area Line' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Approval Setup :: The table 'Approval Setup' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Approval Code :: The table 'Approval Code' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Approval Templates :: The table 'Approval Templates' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Additional Approvers :: The table 'Additional Approvers' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table DO Payment Setup :: The table 'DO Payment Setup' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table DO Payment Card Type :: The table 'DO Payment Card Type' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Mini Pages Mapping :: The table 'Mini Pages Mapping' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Integration Page :: The table 'Integration Page' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Unsynchronized Category :: The table 'Unsynchronized Category' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table GDPdU XML Buffer :: The table 'GDPdU XML Buffer' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table IFB Setup :: The table 'IFB Setup' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table IFB Rate :: The table 'IFB Rate' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table IFB Periodaccount :: The table 'IFB Periodaccount' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Swiss QRBill Buffer :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.
Table Swiss QRBill Buffer :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.
Table Swiss QRBill Billing Detail :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.
Table Swiss QRBill Billing Detail :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.
Table Swiss QRBill Billing Info :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.
Table Swiss QRBill Billing Info :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.
Table Swiss QRBill Layout :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.
Table Swiss QRBill Layout :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.
Table Swiss QRBill Reports :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.
Table Swiss QRBill Reports :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.
Table Swiss QRBill Setup :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.
Table Swiss QRBill Setup :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.
Table Saved Filter Header :: The table 'Saved Filter Header' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Saved Filter Lines :: The table 'Saved Filter Lines' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Chart Buffer :: The table 'Chart Buffer' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Collaborateur :: The table 'Collaborateur' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Saisie des temps :: The table 'Saisie des temps' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Reportselection Comf. Invt. :: The table 'Reportselection Comf. Invt.' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.
Table Reportselection Comf. Purchase :: The table 'Reportselection Comf. Purchase' cannot be located. Removing tables is not allowed unless they are temporary or are being moved by migration to another app.

I have the same question (0)
  • raelhefn Profile Picture
    on at

    Hi Isa,

    Could you please refer to this Doc : dynamicsuser.net/.../changing-the-primary-key---key-already-exists

  • Isa Tahiri Profile Picture
    20 on at

    Hi,

    Thanks for the answer. But it does not look to be my case. We never touched these tables. My guess is that I do something wrong in the upgrad process. Any other suggestions ?

    As said in the step 11 of the upgrade procedure i have to revert the order and published the application customization before the customer customization. Might that be the cause ? 

    Thanks for your answer. 

    BR

    ISA

  • Isa Tahiri Profile Picture
    20 on at

    This error happens when I do Sync-NAVTenand of the the second version of the table migration extension (empty version) created in the step 2. The Id of this customization is not in the mgiration.json. Must it be ?

  • Suggested answer
    raelhefn Profile Picture
    on at

    Yes, The migration.json file is used to migrate tables and fields from one extension to another. In this case, migration is from the table migration extension to system and base application tables.

    related posts : github.com/.../1244

    docs.microsoft.com/.../upgrade-to-microsoft-base-app-v17

    docs.microsoft.com/.../devenv-migration-json-file

  • Isa Tahiri Profile Picture
    20 on at

    Thanks for the quick answer. 

    I will add the ID in migration.json and try again. 

    I'm migrating from BC 14 CU 18

    pastedimage1608832304507v1.png

    to 17.2  (Dynamics.365.BC.19735)

    According to the matrix, it should be compatible.  

  • Isa Tahiri Profile Picture
    20 on at

    This will probaly fix all exceptions related to the missings tables. About the primary key, I doubt... Let's see

    Again thanks for the answer. This comunity plateform is very reactive. I really appreciate it.  

  • Isa Tahiri Profile Picture
    20 on at

    So I tried and my doubt were correct. All table exception we manged by the migration as soon as i put the ID of the extension in the migration.json. But the primary key issue are still here.

    All these tables are new and do not have data inside. I checked the generated Al files, there are no errors or warnings.

    This a migration from NAV 2013R2 initially. I followed this path :

    NAV2013R2 --> NAV 2018 -->BC14 CU18 --> BC17.2 and then BC Online hosted by MS.  

    I'm a bit out of options here. Deleting the table at source --> Error on compilation to other objects. 

    Any suggestions will be welcome.

    Merry Christmas :-)

    ERROR on runnign command :  Sync-NAVApp -ServerInstance bc170 -Name "bc14baseapptablesonly" -Version 1.0.0.1

    -------

    Table VAT Reg. No. Srv. Template :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

    Table VAT Reg. No. Srv. Template :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.

    Table VAT Registration Log Details :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

    Table VAT Registration Log Details :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.

    Table Swiss QRBill Buffer :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

    Table Swiss QRBill Buffer :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.

    Table Swiss QRBill Billing Detail :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

    Table Swiss QRBill Billing Detail :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.

    Table Swiss QRBill Billing Info :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

    Table Swiss QRBill Billing Info :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.

    Table Swiss QRBill Layout :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

    Table Swiss QRBill Layout :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.

    Table Swiss QRBill Reports :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

    Table Swiss QRBill Reports :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.

    Table Swiss QRBill Setup :: The previous primary key 'Key1' cannot be located. Changing the primary key is not allowed.

    Table Swiss QRBill Setup :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key 'Key1' the primary key again.

    ----------

    Schema --> NAV 2018 & BC 14

    Swiss QRBill Setup keys ----> {key(Key1; "Primary key"){Clustered = true;}}

    Swiss QRBill Reports keys ----> {key(Key1; "Report Type"){Clustered = true;}}

    Swiss QRBill Layout ----> keys{key(Key1; "Code"){Clustered = true;}}

    Swiss QRBill Billing Info ----> keys {key(Key1; "Code"){Clustered = true;}}

    Swiss QRBill Billing Detail keys ----> { key(Key1; "Entry No.") {Clustered = true; }}

    Swiss QRBill Buffer ----> keys{key(Key1; "Entry No."){Clustered = true;}}

    VAT Registration Log Details ----> keys{key(Key1; "Entry No."){Clustered = true;}}

    VAT Reg. No. Srv. Template --> keys { key(Key1; "Code") { Clustered = true; } }

    Schema 17.2

    Swiss QRBill Setup ----> {key(PK; "Primary key"){Clustered = true;}} --> Table 'Swiss QRBill Setup' is removed. Reason: moved to Swiss QR-Bill extension table 11512 Swiss QR-Bill Setup.

    Swiss QRBill Reports ----> {key(PK; "Report Type"){Clustered = true;}} --> Table 'Swiss QRBill Reports' is removed. Reason: moved to Swiss QR-Bill extension table 11514 Swiss QR-Bill Reports.

    Swiss QRBill Layout ----> keys{key(PK; "Code"){Clustered = true;}} --> Table 'Swiss QRBill Layout' is removed. Reason: moved to Swiss QR-Bill extension table 11513 Swiss QR-Bill Layout.

    Swiss QRBill Billing Info ----> keys {key(PK; "Code"){Clustered = true;}} --> Table 'Swiss QRBill Billing Info' is removed. Reason: moved to Swiss QR-Bill extension table 11511 Swiss QR-Bill Billing Info.

    Swiss QRBill Billing Detail keys ----> { key(Key1; "Entry No.") {Clustered = true; }} --> Table 'Swiss QRBill Buffer' is removed. Reason: moved to Swiss QR-Bill extension table 11510 Swiss QR-Bill Buffer.

    Swiss QRBill Buffer ----> keys{key(PK; "Entry No."){Clustered = true;}}

    VAT Registration Log Details ----> keys {key(PK; "Log Entry No.", "Field Name"){Clustered = true;}}

    VAT Reg. No. Srv. Template --> keys {key(PK; Code) { Clustered = true;}}

  • Suggested answer
    raelhefn Profile Picture
    on at

    Hi,

    Could you Please run a SQL Server Profiler trace while running the Sync-NAVApp cmdlet in order to get a list of missing keys /  indexes per affected table. After all affected tables were handled in this way the Sync-NAVApp cmdlet could succeed.

  • Isa Tahiri Profile Picture
    20 on at

    Hi !

    Sorry for the late answer. I actually went for a more drastic way.

    I could delete the Swiss QRBill XXX tables without breaking the integrity. (I could compile without error)

    For the two last tables VAT Registration Log Details + VAT Reg. No. Srv. Template.

    The table VAT Reg. No. Srv. Template was referenced somwhere else in a local function. I commented this function temporary.

    Now I'm running in a addition issue. Which seems to be more difficult.

    Can you help ? I opened a ticket for this :

    community.dynamics.com/.../migration-bc14-to-bc-17-2-invalid-object-name-dbo-country_region

    Many thanks

    ISA

  • DigiTecKid Profile Picture
    56 on at

    Hello Isa,

    I'm upgrading from NAV 2013 to BC17 and have run into some of the same errors you had in the final part of your BC14 to BC17 upgrade with the Sync-NAVApp of the migration extension (empty version).

    Can you give me more detail on what you did to resolve this error?  Also, did you find out what caused it?

    "Sync-NAVApp : Table VAT Reg. No. Srv. Template :: The previous primary key 'Key1' cannot be located. Changing the

    primary key is not allowed.

    Table VAT Reg. No. Srv. Template :: Introducing a new key 'PK' as the primary key is not allowed. Please make the key

    'Key1' the primary key again.

    Table VAT Registration Log Details :: The previous primary key 'Key1' cannot be located. Changing the primary key is

    not allowed.

    Table VAT Registration Log Details :: Introducing a new key 'PK' as the primary key is not allowed. Please make the

    key 'Key1' the primary key again.

    Table Approval Setup :: The table 'Approval Setup' cannot be located. Removing tables is not allowed unless they are

    temporary or are being moved by migration to another app.

    Table Approval Code :: The table 'Approval Code' cannot be located. Removing tables is not allowed unless they are

    temporary or are being moved by migration to another app.

    Table Approval Templates :: The table 'Approval Templates' cannot be located. Removing tables is not allowed unless

    they are temporary or are being moved by migration to another app.

    Table Additional Approvers :: The table 'Additional Approvers' cannot be located. Removing tables is not allowed

    unless they are temporary or are being moved by migration to another app.

    Table DO Payment Setup :: The table 'DO Payment Setup' cannot be located. Removing tables is not allowed unless they

    are temporary or are being moved by migration to another app.

    Table DO Payment Card Type :: The table 'DO Payment Card Type' cannot be located. Removing tables is not allowed

    unless they are temporary or are being moved by migration to another app.

    Table Mini Pages Mapping :: The table 'Mini Pages Mapping' cannot be located. Removing tables is not allowed unless

    they are temporary or are being moved by migration to another app.

    Table Integration Page :: The table 'Integration Page' cannot be located. Removing tables is not allowed unless they

    are temporary or are being moved by migration to another app."

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,785

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,007 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 948 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans