Go To page layout field of that object,,then scroll down in the Bottom,,,there you can see a field name as Notes & Attachement ,,on the the is a symbol ===> "--" llike this,,,click on that ,,,then save ,,,so it will be removed from Page
I am not seeing any such options. I opened the content document object and saw in fields and relationships, I could not find any fiell. and also, I have clicked on Pagelayouts, i didn't find any page layout. Could you please provide screenshots for the solution you explaind above. so, that it would be helpful for me in resolving this.
Hi Pradeep, You can not remove the Delete button from the record option in notes and attachments but you can modify all permission from the user. Limit the user, assign some permissions to user like as Read and write in this case. user can't View All/Modify, you can disable the button functionality.
if you have any query please comment. --------------- If you find your Solution then mark this as the best answer to close this question.
For that requirement I have went with below one, and in debug it is showing parent ID value as null. Please crct if i did something wrong.
public static void restrictDeleteFiles(list<ContentDocument> oldlistContentDocument) {
for (ContentDocument cd : oldlistContentDocument ) { system.Debug('parent id is----'+cd.ParentId); if(cd.ParentId.getSObjectType().getDescribe().getName() == 'custom_object__c'){ cd.adderror('You Cannot delete a record once uploaded.'); }
HI Pradeep, >Attachments will follow the same security as the parent record. >A profile user's will able to delete attachments if they have attachment parent object delete access. >Also profile user's must have read/write record level access of the parent object.
Go To page layout field of that object,,then scroll down in the Bottom,,,there you can see a field name as Notes & Attachement ,,on the the is a symbol ===> "--" llike this,,,click on that ,,,then save
,,,so it will be removed from Page
Mark my answer as best if its helped you
I am not seeing any such options. I opened the content document object and saw in fields and relationships, I could not find any fiell. and also, I have clicked on Pagelayouts, i didn't find any page layout. Could you please provide screenshots for the solution you explaind above. so, that it would be helpful for me in resolving this.
Thanks,
Pradeep.p
You can not remove the Delete button from the record option in notes and attachments but you can modify all permission from the user. Limit the user, assign some permissions to user like as Read and write in this case. user can't View All/Modify, you can disable the button functionality.
if you have any query please comment.
---------------
If you find your Solution then mark this as the best answer to close this question.
Thank you!
Regards,
Suraj Tripathi
For that requirement I have went with below one, and in debug it is showing parent ID value as null. Please crct if i did something wrong.
public static void restrictDeleteFiles(list<ContentDocument> oldlistContentDocument) {
for (ContentDocument cd : oldlistContentDocument ) {
system.Debug('parent id is----'+cd.ParentId);
if(cd.ParentId.getSObjectType().getDescribe().getName() == 'custom_object__c'){
cd.adderror('You Cannot delete a record once uploaded.');
}
}
}
Thanks,
Pradeep.p
>Attachments will follow the same security as the parent record.
>A profile user's will able to delete attachments if they have attachment parent object delete access.
>Also profile user's must have read/write record level access of the parent object.
Related:https://salesforce.stackexchange.com/questions/159644/how-can-we-give-permission-to-profile-users-to-delete-the-notes-and-attachments
Limiting ability to add or delete Attachments:https://trailblazers.salesforce.com/answers?id=90630000000D0LpAAK
If this information helps, please mark the answer as best. Thank you
Please refer the link:
https://sfdc-concepts.blogspot.com/2021/10/difference-between-delete-and-remove.html