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 72,061 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,201 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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,936 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,378 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans