How to add custom field to role (CMS_Role) table

This article shows you how you can modify the CMS_Role table and add a custom field.
You can add your own field into CMS_Role table in database. However, you would also need to refresh XMLSchema and FormDefinition of CMS_Role table using following code (you need to execute it) before using this custom role field:

DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.role");

if (dci != null)
dci.ClassXmlSchema = CMS.DataEngine.TableManager.GetXmlSchema("CMS_Role");


// Generate queries
SqlGenerator.GenerateDefaultQueries(dci, true, false);

Please note that since CMS.Role class is not default system table, you might lose your custom field after upgrading.

See also:

Applies to: Kentico CMS 4.0
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.