Hide/show buttons with list control
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 08:28 AM
Hi there,
I'm trying to hide or show buttons and links from related list so I have tried with scripts in 'omit conditions'.
The requirement is very simple. Users, who have ACL write permissions for parent record, should be able to create or edit related list records.
I have achieved to hide links for users that have no permissons but it's not working with the 'New' button
This is the script which I have write for both conditions:
var omit = true;
if (current.parent.canWrite()) {
omit = false;
}
answer = omit;
and as I mentioned it works for 'omit links' but not for 'omit new'
Any suggestion?
- 878 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:30 PM
I have found the solution. You just need to be sure that ACLs in parent table are propertly configured and it's very important. The script is working without problems. In fact, you can use a more simplify script like this:
if (parent.canWrite());
true;
else;
false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 10:03 AM
Hi @Leonel Sandroni,
You need to check with parent.canWrite() method. Try this updated scripts,
var answer;
if (parent.canWrite() == true) {
//Do not remove the 'New' button
answer = false;
} else {
//Remove the 'New' button
answer = true;
}
answer;
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 10:58 AM
This script hides the new button for all users but I'll try tro modify it. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 11:03 AM
Hi @Leonel Sandroni,
For me it is working as expected!
If user do not have write access for demand. The New button will be hidden.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 11:39 AM
Ok, I should check the ACLs in dmn_demand_task. Maybe I have modified OOTB 'create' ACL.