How to filter out options in a multiple choice list based on user role?

HI, I have what i thought was a fairly simple problem but cant work out how to do it.  I have a STATUS field which has multiple choice input, for example:   CREATED, SPECIFIED, CODED, TESTED, APPROVED.

I want to limit the ability to set the field to APPROVED to only those users who have a role APPROVER.  For anyone else, I'd like to either hide that option on the radio button list, or gray it out, or even pop up a message saying they cant select that option because they are not an approver.

Any idea how I can achieve this?



I believe this is what you are looking for, I got this code from this community somewhere...

//Remove restricted entries from a dropdown. In this case, high-level Account Roles.
$(document).on('mousedown keyup',
'#view_522_field_62_chzn' + //Roles field for Add account
', #view_523_field_62_chzn' //Roles field for Edit account
//', #view_XXX_field_YYY_chzn' //Add more here as needed. Don't forget the + at end of line!
, function () {
//$("ul.chzn-results li:contains('Supervisor')").remove();
$("ul.chzn-results li:contains('Admin')").remove();
//$("ul.chzn-results li:contains('SuperAdmin')").remove();



Hi Dean,
this is almost what I want for something slightly different but simpler I think.

On a specific view I want to restrict the choices available regardless of role. So I assume the snippet would be similar but without these lines?

#view_522_field_62_chzn’ + //Roles field for Add account
‘, #view_523_field_62_chzn’ //Roles field for Edit account

So I tried this and nothing happened (this is JS not CSS isn’t it…?). Any tips on this?

//Remove Absence Types from a dropdown (Add Absence).
$(document).on(‘mousedown keyup’,
//’, #view_160_field_311_chzn’ //Add more here as needed. Don’t forget the + at end of line!
, function () {
//$(“ul.chzn-results li:contains(‘Unpaid Leave’)”).remove();
$(“ul.chzn-results li:contains(‘Unpaid Sick’)”).remove();
//$(“ul.chzn-results li:contains(‘Paid Sick’)”).remove();

Thanks a lot


I have watched this with interest and have an alternative suggestion - which is to let the database do the hard work for you. Set the field up as a connection instead of a Multiple Choice and have field(s) in the Looked Up object which you can then use to filter the dropdown on forms as you need.

Hope this helps - wherever possible I think it’s best to avoid JS - and use the database for what it’s good at.


Thanks Julian, I’ll have a look at that suggestion and see how I get on. I agree though about getting the system do do the job instead of using JS etc to create workarounds.


Hi @JulianKirkness,

Very clever! Once I understood the idea it was easy and works well (assuming you meant to create a new object with one record for each of the choice options).

Although it doesn’t use any code it does feel a bit like you are creating a workaround that is slightly outside the intended scope of the objects, connections etc, but I like it anyway!


Hi @Hugo

You’re welcome - and in my view this is far from being a ‘work around’ - simply using the database for what it does best.


Hi @JulianKirkness,

fair enough, I’ll accept your view entirely - I am still learning and don’t think I would have thought of that in a long time!

Thanks again