Skip to main content

Notifications

Announcements

No record found.

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

Change primary Key fields

(1) ShareShare
ReportReport
Posted on by 33
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 77,351 Super User 2025 Season 1 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,198 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 54 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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,234 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,994 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans