Make field Read only in the list view

Lucky1
Tera Guru

Hello all,

 

I have a requirement, in a list view, I want to make a field (u_enable) editable to only one Assignment group, 

On the form view, I have written a UI policy to show the 'Enable' field and make it mandatory, if the Assignment Group is some abc group.

 

But in the list view, every other Assignment group is able to Edit the field.

 

So, please help me on, the field can be visible on the list view, but other than abc assignment group, no other group can edit it.

 

Please help me how can I do this?

 

 

Regards,

Lucky

1 ACCEPTED SOLUTION

Hi @Lucky1,

 

I've tweaked the script for you. This should work. It's tried and tested on my PDI.

 

answer = checkUser();

function checkUser(){
if (gs.getUser().isMemberOf('62826bf03710200044e0bfc8bcbe5df1')) { //replace the sys_id with your assignment group 
    return true;
}
else{
    return false;
}

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

View solution in original post

6 REPLIES 6

Satishkumar B
Giga Sage
Giga Sage

@Lucky1 create a ACL to restrict editing of the field to only the specified group (abc) in the list views.

SatishkumarB_0-1723212320225.png

var answer = false; // Default value

if (gs.getUser().isMemberOf('5f6441efc0a8010e0177fcb589156352')) { //replace the sys_id with your assignment group sys)D
    answer = true; // Set to true if the user is a member of the specified group
}

 

…………………………………………........................................................................................
Mark it helpful 👍and Accept Solution !! If this helps you to understand.

…………………………………………........................................................................................

Robbie
Kilo Patron
Kilo Patron

Hi @Lucky1,

 

This is very easily achieved with an ACL of type 'list-edit'.

 

To implement this:

- Elevate your role as 'security_admin'

- Create new list edit ACL on the table you have created your 'u_enable' field on

- If you want to ensure not even admins can override this ability, check the 'advanced' checkbox as true

- Within the script section:

 

 

answer = checkUser();

function checkUser(){
if (gs.getUser().isMemberOf('62826bf03710200044e0bfc8bcbe5df1')) { //replace the sys_id with your assignment group 
        return true;
    }
else{
    return false;
}

 

 

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

Hello Robbie,

 

I have written ACL like

list-edit ACL on Incident - Enable

Roles: ITIL

Script:

if(gs.getUserID().isMemberOf('sys_id_of_a_group'){

gs.log("Logged in user is "+gs.getUserID());

answer = true;

}

else

{

answer = false;

}

 

But, the log itself is not coming.

I checked and the user is part of the Assignment group mentioned in the isMemberOf 

 

 

Regards,

Lucky

 

@Lucky1 replace your if condition with if(gs.getUserID().isMemberOf('sys_id_of_a_group')

Please Mark it helpful and Accept Solution!! If this helps you!!