0

I am trying to figure out how to rename a list column on SharePoint Online, for example I would like to rename the column "Category2" to "Category".

I have seen JS examples of doing this on SP2013 however doesn't seem to work.

My column ID is: diidSort18Category20

I've previously tried this code:

    <script type="text/javascript">
 _spBodyOnLoadFunctionNames.push("ChangeColumnName"); // Call ChangeColumnName function on PageLoad
        function ChangeColumnName() 
          {
            RenameColumn('diidSort18Category20', 'Category'); //Provide Column ID and New Column name
        }
        function RenameColumn(colID, NewHeader) {
            try {
                document.getElementById(colID).innerHTML = NewHeader; //Change Header Name
                document.getElementById(colID).title = "Sort by " + NewHeader; // Change Tooltip value
            }
            catch (err) {
                alert('Invalid Column ID:' + colID);
            }
        }
 </script>
  • 2
    Are trying to rename it by script? why dont you rename manually. – Sunil Sahu Apr 30 '18 at 13:34
  • I cant rename manually as "Category" is a system-reserved column and can only be used as a plain-text field. We need to use the Category2 column as a choice field. – surfnode Apr 30 '18 at 13:47
  • What kind of list template or Content Types are being used? "Category" is not a system reserved column. (Create a new list from the "Document" or "Custom" templates and add a new column named "Category". – Mike Smith - MCT - MVP Apr 30 '18 at 13:58
  • Do you want change the Display name of the field or internal name. – Sunil Sahu Apr 30 '18 at 14:18
  • I've managed to get round this by renaming the reserved fields on the site columns and then creating new fields under a new column group. – surfnode Apr 30 '18 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.