Skip to main content

Notifications

Community site session details

Community site session details

Session Id : MSFLDqrbHAicGMaSicHmxd
Power Apps - Microsoft Dataverse
Suggested answer

Create Table -> Naming Primary Column -> {Table Name} Id -> A Few Questions

Like (1) ShareShare
ReportReport
Posted on 20 Aug 2024 14:54:59 by 24
Hello,

I was following a Microsoft tutorial Exercise - Create two tables and relate them by using a one-to-many relationship - Training | Microsoft Learn and discovered some weirdness in naming of primary columns.

Repo Steps:
  1. Create a table, using advanced properties
  2. Set the display name of the table to be whatever you like, I like bread so I chose Bread
  3. Change to the primary column tab
  4. Change the display name of the primary column to be {Table Name} ID, so for me that was Bread ID
  5. Get greeted by a Failed to create entity with logical name crc0a_bread and object type code -1. Exception: Microsoft.Crm.CrmException: Custom attribute name 'crc0a_BreadID' cannot be same as the primary key for entity 'crc0a_bread... (your exception might look a little different if you're not using bread as an example)
  6.  Accept, you can't call your primary column what you want and so call it something else, and create the table
  7.  In your newly created table, in the {Table Name} columns and data section, click the primary column and then edit
  8. Set the display name to the value which was previously forbidden
  9.  Success, for "bonus" success if you refresh the page the primary column also updates in the table properties
So my questions are threefold.
  1. Is this a bug, or is it documented somewhere you can't create a table with a primary column that has a name of {Table Name} ID because it will clash with something Dataverse is doing behind the scenes, and if so what is Dataverse doing behind the scenes?
  2. If I can't create a column with the forbidden name, why on earth am I allowed to update it to the forbidden name of {Table Name} ID, what has Dataverse done since I created the table such that the problematic column name is now valid
  3. Why can't I edit the name of the primary column through the table properties?  When I'm looking at my table and click properties, all the primary column stuff is readonly, it seems weird I can edit this column through the columns view and through the columns & data view, but not the table properties view
Many Thanks
 
Image 1 -> Unable to create the table Bread as Bread ID is clashing with the PK for the entity bread followed by a stack trace
 
Image 2 -> Editing the primary name column to be Bread ID, which wasn't allowed at creation time
 
Image 3 -> Behold my new Bread ID Column (note well, the table properties hasn't yet updated, that requires a full refresh)
 
Image 4 -> Not Being Allowed To Edit The Primary Column Via The Table Properties
  • Michael E. Gernaey Profile Picture
    42,048 Super User 2025 Season 1 on 27 Aug 2024 at 05:58:08
    Create Table -> Naming Primary Column -> {Table Name} Id -> A Few Questions
    Ok

    Yeah my answer is the answer, been this way since day one of the platform.
  • Fubar Profile Picture
    7,875 Super User 2025 Season 1 on 21 Aug 2024 at 22:33:06
    Create Table -> Naming Primary Column -> {Table Name} Id -> A Few Questions
    When creating the field you don't actually have to save as a different Display Name and then go back and change it, you can enter the Display Name you want and then expand the Advanced and then update the schema name and then save (when you are creating the schema name is editable, but is not displayed by default, to see or change it you can expand the Advanced when you are creating also).
  • JA-06080933-0 Profile Picture
    24 on 21 Aug 2024 at 07:10:31
    Create Table -> Naming Primary Column -> {Table Name} Id -> A Few Questions
    Thanks for your help guys, that's cleared things up a lot. So I was creating a table called Bread, that gets a schema name of xxxxx_bread, and is backed by a primary key with schema name xxxxx_breadid. When I want to set the primary name at creation time, to be Bread ID because I like it / am following the customer's requirements / using an ERD diagram as defined by the tech lead (choose as appropriate), DataVerse will ungraciously tell me I can't do that because that new column will have a schema name of xxxxx_breadid!! So when I name the column something else, I get a schema name of xxxxx_somethingelse and then in another step I can change the display name of the primary name column, to be Bread ID as was originally required and everyone's happy. Well apart from me who's had to go through a 2 step process and has lots of ideas how DataVerse could handle this situation better ;)

    P.S. I'll come back late to mark FLMike's answer as the accepted answer but I'm currently getting a spinner which spins indefinitely when I mark it as the accepted answer :( I see a 403 in the network tab, so either I've suddenly lost forum permissions or the API is misbehaving
  • Suggested answer
    Fubar Profile Picture
    7,875 Super User 2025 Season 1 on 20 Aug 2024 at 22:11:34
    Create Table -> Naming Primary Column -> {Table Name} Id -> A Few Questions
    As per FLMike's response.  However, note they are being a bit 'cute' in the Exercise you linked to for the Table they set both the Display and Plural Names of the Table to be Plural, and then set the Primary Column display name to be Singular (so if you followed it 100% you wouldn't get the error you are - as the schema name of the primary key would be plural and the schema name of the Primary Name would be singular).
     
    When you create a Table a new Column is automatically created that is the tables schema name with a suffix of "id" - this column is used by the system to hold a guid for each record created and it is the Primary Key e.g. the Contact tables schema name is contact and its primary key is contactid, or if you created a new table called Table1 its schema would be new_table1 and it would have new_table1id. 
    (also FYI, the Primary Name column is not the primary key column, it is just a column whose value is displayed to the user when used in a Lookup).
     
    You cannot subsequently create another column that has the same schema name as another column in your Table - but when you create a new column you can set a specific schema name (expand the Advanced Options), so can still create Columns with duplicate Display Names but that have a unique schema names.

    Also, once created whilst you can change the Display Names you cannot alter the schema name of the Table or a Column (or most other objects in Dataverse).
  • Suggested answer
    Michael E. Gernaey Profile Picture
    42,048 Super User 2025 Season 1 on 20 Aug 2024 at 16:46:23
    Create Table -> Naming Primary Column -> {Table Name} Id -> A Few Questions
    Hi,
     
    No it's a misunderstanding on your part how it works.
     
    You have
    Label (what they call Name) and they should not.
    Schema Name
    Logical Name
     
    When you typed in Bread (the label), the system knew when you clicked save, it would want to create the logical/schema name of publisherprefix_nameid
    in your case, XXX_breadid because logical names are always all lowercase
     
    But that had already been used when you named the Table Bread.
     
    Now, when you instead called the primary column Banana, it created
    xxxx_BananaId
    xxxx_bananaid
     
    YOU then went in and changed the LABEL so what you had was
     
    String Name/Label (call it the friendly UI string)
    Bread
    back end its called
     
    xxxx_BananaId
    xxxx_bananaid
     
    so you were not changing the schema or logical name you were changing the friendly string/name
     
    So no, its not a bug, its how it works, on you have more experience in the entire storage layer and it will have made sense :-)
     
     
     
     

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
stampcoin Profile Picture

stampcoin 15

#2
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 9 Super User 2025 Season 1

Overall leaderboard

Featured topics