Is there a way to define a template field where a user can select a Sitecore role from a dropdown? I noticed that in Sitecore 8.2 under the Developer Types section there is a Sitecore User field type, its a pity they didn't make a Sitecore Role one as well while they were at it... My next choice would be to just use a single-line text field which I can just about justify since this is for an admin feature.

1 Answer 1



If you mean, is there an OOTB solution for this, the answer is unfortunately no.


The question has come up before. I'm sure you found this as well. The solutions listed here are pretty dated and I'm hoping someone has a more current recommendation. However this might give you some ideas.

All solutions listed here involve some form of creating your own FieldType and adding it to Sitecore.

My suggestion

If you're going down the route of a custom field, my suggestion would be to base your code on the UnboundDropList custom field. I use this or variations of this on most projects I get involved in. Full reference source here:

To achieve what you want, you would alter line 36:

foreach (string s in Source.Split('|'))

To something like this:

foreach(Role r in RoleManager.GetAllRoles())

And remove this condition:

if (String.IsNullOrEmpty(Source))
    error = "No source list specified for field";

And that should be pretty much all you need. I didn't have time to compile, set up and test unfortunately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.