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
MEstesMEstes 

I'm looking for a trigger (or other method) to block file attachments when a record is at a certain stage (Evaluate by Stage field or "Locked" checkbox))

I have a custom Object (Lab_Request__c) and it goes through an approval process.  We've found Users can add Files to the record after the approval has completed.  Some users (Lab Manager) shoud be able to still add files, but not the rest. 

So 
1. If Status = Complete and User does Not have Permission Set A, then Block the Addition of Files to this record.

I had a trigger similar to this with cases, (no files on closed cases) but I'm having trouble finding the code now...
Jitendra Singh ShahiJitendra Singh Shahi

Hi,

please check the "Modify All", "Modify All Data" object-level permission for Lab_Request__c object for lab manager profile. If it is checked then uncheck it. While unchecking please see other permissions edit, read etc should not change.

and also check the approval process who can edit a record and set it to admin only when the record is locked.

I hope this will help, Please mark it correct answer if it helps or reply here if it doesn't.