Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. NoteOnContentDocument on ContentDocument (before delete) {
  2. for (ContentDocument c : Trigger.old){
  3. List<ContentDocumentLink> links = [
  4. SELECT LinkedEntityId
  5. FROM ContentDocumentLink
  6. WHERE ContentDocumentId= :c.Id
  7. ];
  8. if (links.size()>0 && Approval.isLocked(links.get(1).LinkedEntityId)){
  9. c.addError('Approval pending. You do not have the permission to edit/delete this note, please contact your administrator.');
  10. }
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement