ACL to hide fields .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 09:39 PM
Hi All,
I have created an ACL (Access Control List) and set the operation = 'read'.
The requirement is to display the 'short_description' field for the 'cab approval' group while hiding it for users outside that group. I attempted to implement this using code, but it doesn't meet the requirement. How can I achieve this?
Image
code
(function executeRule(current, previous) {
if (current.assignment_group == 'bf2d666f1b457f4042be2fc4bd4bzb97' ) { //cab approval
// Check the current user
var currentUser = gs.getUser();
if (currentUser == '60bb75f21b233510656fc802604bcb00') {
current.setReadAccess('short_description', true); //visible for the user
} else if (currentUser == '038c0d939718d550a2c79534a253af06') {
current.setReadAccess('short_description', false); //hide for the user
}
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 09:47 PM
Hi @Pankaj ,
I believe what you can do for checking if the logged in user is part of a that specific group :
if(gs.getUser().isMemberOf('CAB'))
{
answer=true;
}
else
{
answer=false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 10:57 PM
Hi @Pankaj ,
If Acl doesn't work you can try writing display business rule and onload client script,
Br:
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.isMemberOf = gs.getUser().isMemberOf('Database');
})(current, previous);
onload:
function onLoad() {
if (g_scratchpad.isMemberOf.toString() == 'true')
g_form.setDisplay('short_description', true);
else
g_form.setDisplay('short_description', false);
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang