Make field editable when group is eligible

jaip3040
Tera Contributor

Hi All,

Please help me on below ACL Part

there 3-groups in system property and a field (time_worked) on incident list am trying to create write ACL to make field  editable for user who is part the group in system property, when i try to make field edit for any other groups which is not there in system property then (time_worked) field should be readonly.

Can any one assist me on this

8 REPLIES 8

GlideFather
Tera Patron

Hi @jaip3040,

please try to add script to the ACL on the update rights in the field.


Something similar to this (not tested, just a drafty):

var userGroups = gs.getUser().getMyGroups(); //eventually call the system property you mentioned

 

var allowedGroups = ['sys_id1', 'sys_id2', 'sys_id3'];

 

if (allowedGroups.indexOf(current.assignment_group.toString()) > -1) {

    answer = true;

} else {

    answer = false;

}

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Chaitanya ILCR
Kilo Patron

Hi @jaip3040 ,

 

replace incident with your table name and field with your field name

 

ChaitanyaILCR_0-1750667317768.png

 

and put this in the script 

and replace your.group.properties.name with your property name

answer = (function() {
    var listOfgroups = gs.getProperty('your.group.properties.name').split(',');//replace with your property name
    var myGroups = gs.getUser().getMyGroups().toString();
    for (var i = 0; i < listOfgroups.length; i++) {
        if (myGroups.includes[listOfgroups[i]])
            return true;
    }
    return false;
})();

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

hi @Chaitanya ILCR 
thanks for the response,
but it is not checking wheather user is part of any group from system property can you please assist how to check that 
my requirement: if user is part of any group in system property then that user should edit field on list,Thank you!

Hi @jaip3040 ,,

that script should work

 

answer = (function() {
    var groups = gs.getProperty('your.group.properties.name');//replace with your property name
    var listOfgroups = groups ? groups.split(',') : []; 
    for (var i = 0; i < listOfgroups.length; i++) {
        if (gs.getUser().isMemberOf(listOfgroups[i]))
            return true;
    }
    return false;
})();

if not try this

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya