Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Change primary Key fields

Posted on by 16
I have a custom table in BC, and I need to add another field into the primary key. However it will not publish if I try that.
This table has no data in it so no issue with losing any data.  I have tried the below method however it seems to have no effect.
 
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,339 Super User 2024 Season 2 on at
    Change primary Key fields
    Hi, just to add one more point, if it is a production environment, please refer to the documentation below.
    Business Central 2021 wave 2 (BC19) new features: Force sync of customer-specific extensions in online environments (ForceSync mode in Production Environment)
    In-depth testing for Force Sync mode in Production Environment (Renaming tables, Renaming fields, Changing field type…)
    https://yzhums.com/18755/
     
    Hope this helps as well.
    Thanks.
    ZHU
  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    Change primary Key fields
    In the launch.json file, set the Schema Update Mode to "Recreate"..
     
     
    Since you mentioned that there is no data in the table, it will automatically delete your existing data. You can proceed either directly publishing the project or by building the project (pressing Ctrl+Shift+B) and then manually uploading the .app file
    Regards
  • Divan Profile Picture
    Divan 53 on at
    Change primary Key fields
    Hi,
     
    Are you using docker or something similar to test the code where it will not publish?
     
    If so you can change the launch.jason file to recreate instead of synchronize:
     
    "schemaUpdateMode": "Recreate"

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans