SharePoint – Cannot change hidden attribute for this field


In case you ever provisioned a Title field with the property Hidden=TRUE, and you need to set it to Hidden=FALSE later, you end up with this enchanting error:

Cannot change hidden attribute for this field

There are a couple of articles that suggest using PowerShell and Reflection, but if you like a pure web / JS solution, here it is:

Get the current SchemaXML for the field. In Chrome, while viewing a list, run the following line by line (the executequeryasync being async, you would need to use a callback if you wanted to run all commands as a block)

let myctx = SP.ClientContext.get_current()
let field = myctx.get_web().get_lists().getByTitle('List 1').get_fields().getByInternalNameOrTitle('Title')
myctx.load(field, 'SchemaXml')
myctx.executeQueryAsync(()=>console.log('success'), (a,error)=>console.log('error',error))

(wait for success here, should take max 1s)

field.get_schemaXml()

(change Hidden=”FALSE” in this string and use it in the set_SchemaXml command)

field.set_schemaXml(`previous string with Hidden="FALSE" instead of TRUE`)
field.update()
myctx.executeQueryAsync(()=>console.log('success'), (a,error)=>console.log('error',error))

That’s it, your field is visible now