removeOption on Status Field - I want to remove the ability to choose it, not the ability to see it

kemmy1
Tera Guru

I have a Status field that has 8 choices.  I only want a user with a particular role to be able to choose the "Cancelled" choice (only when the status is "Review", so I created an onload Client Script to check if the user has that role and removeOption on all the other choices except "Cancelled".

 

The issue is that when the user goes to open up a record that has a status other than "Cancelled" the status field is blank.

 

I also created an ACL that makes the field writeable only if it's in Review status.

 

I tried an onChange Client script and it shows the status if it's not cancelled, but then when I go to change the status, it allows that user to select any choice.

5 REPLIES 5

We decided to do this:

 

var brsStatus = g_form.getValue('status'); 
var brsLabel = g_form.getDisplayValue('status');

           if (g_user.hasRole('x_g_dh5_brs.requester')) {
            g_form.removeOption('status', 'originating aor review');
            g_form.removeOption('status', 'facility approve request');
            g_form.removeOption('status', 'facility rejected request');          
            g_form.addOption('status', brsStatus, brsLabel, 0); //adds the original removed option back to the field           
        }