- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2016 06:01 AM
Hi scripting experts,
i would need some help / hints for a special requirement.
I have a checkbox on the Incident Form, which should be read only for 4 dedicated groups.
So far so easy, i created an ACL for that field and it is working as it should (ALMOST).
Problem i am facing is now, if the User is also member of a different group then the 4 , the field should be editable again.
As an example: The Service Desk Manager belongs to the Service Desk Group , to see what his folks are doing.
He also belongs to the Service Desk Manager group - and he should be able to edit this checkbox field.
But since he also belongs to the Service Desk Group, the field is also greyed out (read only) for him.
Any suggestions ?
thanks
Frank
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2016 06:25 AM
one other way that might be cleaner...
create a read only true false flag.. and a read/write true false flag... initialize both to false
now thumb through the groups that the person is a member of.. and if it is a read only group set read only to true..... if not set read/write to true.
when you have finished all groups you will have both flags set.. and can set the read only status if read only is true.. but read write is false.. if both are false the customer isn't in ANY groups and you decide if it is read only or not based on that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2016 06:07 AM
I think you need to get the group names which he belongs to if the user is part of any group in the 4 groups then make field readonly else editable.
Thanks,
Ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2016 06:09 AM
In your ACL, put in:
answer = checkGroupMembership(gs.getUserID())
You can create a script include (checkGroupMembership) that says:
function checkGroupMembership(user){
var answer = true;
var groups = new GlideRecord('sys_user_grmember');
groups.addQuery('user', user);
groups.addQuery('group.name', 'NOTIN', 'Service Desk, Database, etc.');
groups.query();
if(!groups.hasNext()){
answer = false;
}
return answer;
}
That should give you what you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2016 06:12 AM
First of all identify the groups to which the user is a part of and then in your write ACL, the advanced condition should be like
if(gs.getUser().isMemberOf('group_name') || gs.getUser().isMemberOf('group_name') )
answer = true;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2016 06:20 AM
Hi deepak,
thanks for your reply, but this is issue i am facing. Looking at your code , if the User is Member of 'Service Desk' answer is true.
But what if the User is also Member of the Service Desk Manager Group. Then the answer should be false.
Right now the Service Desk Manager is not able to edit the field, because he also belongs to the Service Desk Group.