SharePoint Tricks: Allow Duplicate Column Names

One of the restrictions of SharePoint I always stumbled upon when clicking a SharePoint site together was the one of duplicate column names. I bet you’ve all seen it. You’re creating some columns (list or site ones) and suddenly SharePoint gives you this error:

SharePoint Tricks: jfjfjf

SharePoint Tricks: Duplicate column name error

I finally got pissed at this problem, so I decided to investigate. Now, as I developed some columns through the feature framework, I knew it was possible to create columns with the same name, Display Name that is. Just look at Title. How many different “Title” columns can you see in the edit view screen? So I decided to take a look in the fldnew.aspx page, and what did I discover? A nice javascript array with all “forbidden” column names. I tried to make that array empty and tried again. Magic! The column name was approved. For some reason the team decided to block duplicate names off. But I feel this can be handy some times, especially when creating site columns. You are bound to hit this limitation some time.

But what does SharePoint do internally? It will always make a unique internal name (eg. if you enter Title, it will create a field with Title0 as internal name and Title as display name) A good practice however is to first create a field with a “good” internal name. Good meaning, no spaces, no weird characters, clear. And afterwards renaming it using this trick. Now, what is the trick you will ask? Well, quite simply: once the fldnew.aspx or fldedit.aspx page is loaded. Head toward the address bar of your browser and enter following javascript.

javascript:g_FieldName={};alert('ok');

This code will clear the “forbidden” column names array and give you a visual confirmation when you can go on.

I hope this little trick will help some of you guys. Use it with wisedom however. :-) ’till next time!

9 Responses to “SharePoint Tricks: Allow Duplicate Column Names”

  1. Sashi Says:

    Great tip,.. Thanks much!
    I always had to think of a different name that conveys the same meaning or add a pre/post-fix to make it different.

  2. Sashi Says:

    Ping back from http://sashi4u.blogspot.com/

  3. Daniel Says:

    Thanks man! You saved my day!!

  4. Diego Says:

    a fantastic reflect save!

  5. The column name that you entered is already in use or reserved | Code-Journey.com Says:

    [...] and it needed to be a site column, so off to google I went and found a post on Tomblog on how to allow duplicate site column display names. Since sharepoint already uses them, there [...]

  6. Dan Says:

    I dont get it! Please use an example including a sample URL. At what point do you add the code simple adding it replaces the whole URL to say javascript:g_FieldName={};alert(‘ok’); which does nothing when hitting Ok and hitting enter take you to that page!?

    At what point do you add the java code? after fldedit.aspx? After work? Add= then java code?
    _layouts/FldEdit.aspx?List=%7B832E2BCD%2DEEAE%2D4AFB%2DAF34%2D4646D411A5BD%7D&Field=Project%5Fx002f%5FWork

  7. Dan Says:

    I figured it out. Once the page(FDLEDIT.aspx or FDLNEW.aspx) has loaded you can simply type this into the address line(replacing everything in there): javascript:g_FieldName={};clear Then simply change the name to use another column name and press OK and done!

  8. Ash Says:

    AWESOME.

    I wish I knew this 5 years ago! :)

  9. Iain Munro Says:

    Hi There

    Always wondered how this would be done and have tried numerous long winded solutions that dont work.

    This works perfectly – just had to try on a new site.

    Thanks again.

    Iain

Leave a Reply