function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ahonahon 

Notes & Attachments

My understanding is CRED permissions on notes, notes & attachments and activities for users should follow same as CRED object permissions on a record. Do you know if there is a way to prevent users from editing/deleting their own notes, notes & attachments and email activity? For example, a user sends an email or creates a new note, then cannot delete. 
VinayVinay (Salesforce Developers) 
Hi Allison,

Yes you can use CRED permission on notes and attachments.  However try using trigger to prevent users from deleting notes and attachments.
trigger NoteTrigger on ContentDocument (before delete) {
    for (ContentDocument c : Trigger.new) {
        if (c.FileType == 'SNOTE') {
            c.addError('You cannot delete a Note');
        }
    }
}

Please mark as Best Answer if above information was helpful.

Thanks,
ahonahon
I am not able to add apex triggers to the developer console at this time as a system admin/developer. I get an errror message "Entity is locked. Can not create Apex Trigger on an active organization."
VinayVinay (Salesforce Developers) 
Based on error message, Only Developer Edition, Sandbox, and Trial organizations have the ability to create, edit, and delete Apex classes and triggers directly in the Salesforce CRM user interface. Unlimited Edition and Enterprise Edition production organizations can execute Apex and can view Apex in the user interface, but modifying Apex in the user interface is not allowed.

Check below reference for same.
https://help.salesforce.com/s/articleView?id=000385067&type=1

Please mark as Best Answer if above information was helpful.

Thanks,
ahonahon
Ill work on it in my sandbox and see if that resolves the error, thanks.
VinayVinay (Salesforce Developers) 
Great,  Please mark as Best Answer if above information was helpful.