how to restrict list view edit of state of change records?

sai190
Tera Contributor

hi,

I want to restrict edit of state fields for list view  where only change manager role needs to be able to see closed successful and closed with defects options in state, even the admin should not see these two options, rest of the options of the state field can be editable by anyone.

can anyone help me with this?

 

in the form view i have written a code for hide on form view but unable to do it on list view?

 

function onLoad() {
   
    var flag = g_user.hasRole('change_manager');
    if(flag != true ||  g_user.hasRole('admin'))
        {
            g_form.removeOption('state', '3');
            g_form.removeOption('state', '14');            
        }  
}

20 REPLIES 20

yes for list view its all or nothing. 
if you try conditions it will restrict change role to edit


***Mark Correct or Helpful if it helps.***

tell me you latest requirement what do want to do now. so i understand better and give you exact solution
because you cannot remove options from list on cellEdit


***Mark Correct or Helpful if it helps.***

sai190
Tera Contributor

No one, including the admin role, should be able to close a change.  For Change States, "Closed Successful" and "Closed with Defects", only the Change Manager role should be allowed to set these states. 

This maybe because of admin override
Try ACL with list editing 

Resolution

If there is important data (such as HR information) that should not be modified or seen by the 'admin' role, additional steps need to be taken to prevent admin users from having too much access. 

If the role requirement is removed on an ACL and the Admin Overrides checkbox is unchecked, a scripted role check to ensure users do not have the admin role will keep the admin user from having too much access.

Here is an example of a simple script to add to an ACL: 

if (gs.hasRole('hr_admin') && !gs.hasRole('admin')) { 
answer = true; 


else { 
answer = false; 
}

***Mark Correct or Helpful if it helps.***

before doing that 

try to add in your query that 
!hasRole == 'admin'


***Mark Correct or Helpful if it helps.***