Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Group Manager should have access to edit members to the group their own in UAT,SIT.

Suresh_32
Tera Expert

Group Manager and Secondary Manager should have access to edit (add/remove) members to the group(s) they own in UAT, SIT & PREPROD (not in PROD & DEV) 

Edit buttton should visible to the group managers and secondary manager in UAT, SIT AND PREPROD not in Dev and Prod instances.

 

Please help me to implement this functionality.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Suresh_32 

you can configure the list control and use Omit edit condition script field

check the instance name and show/hide

If that field is not present when you configure list control then confirm the form layout and add that

AnkurBawiskar_0-1738383289798.png

Then use this script in the field

answer = true; // omit it
var instanceName = gs.getProperty('instance_name');

if (instanceName == 'UAT Instance Name' || instanceName == 'SIT Instance Name' || instanceName == 'PREPROD Instance Name') {
    answer = false; // don't omit it
}

AnkurBawiskar_1-1738383496856.png

 

Also ensure manager and secondary manager is able to edit using ACL, refer below link for that and enhance

How to configure Group Members (sys_user_grmember) edit capability, so that only the Group Manager i... 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

We found issue while doing testing, If Secondary Manager is having more than one manager, it is not working.

Edit button is not visible for the secondary managers.

I tried with the below code in Omit edit condition, but it is not working, please help me to resolve this issue. 

 

answer = true; // omit it
var instanceName = gs.getProperty('instance_name');

if (instanceName == 'citigroupitsmdev' || instanceName == 'citigroupitsmsit' || instanceName == 'citigroupitsmtest' || instanceName == 'citigroupitsmpreprod') {

    if (gs.hasRole('user_admin') || parent.manager == gs.getUserID()) {
        answer = false; //Show the 'Edit' button if user has 'user_admin' role or is group manager
    }
    var secMgr1 = parent.u_secondary_manager;    
    var secMgr2 = secMgr1.split(',');    
    for (var i = 0; i < secMgr2.length; i++) {        
        var secMgr3 = secMgr2[i].toString();
        if (secMgr3.trim() == gs.getUserID()) {          
            answer = false;
        }

    }
} else {
    if (gs.hasRole('user_admin')) {
        answer = false; //Show the 'Edit' button if user has 'user_admin' role or is group manager
    }
}

Suresh_32
Tera Expert

It is working fine.