Guest User

Untitled

a guest
Aug 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Trigger AccountLockRecord on Account (before insert, after update) {
  2.  
  3. For (Account soAccount: Trigger.New){
  4.  
  5. List<Account> lstAccount = new List<Account>();
  6.  
  7. If (soAccount.ISLock__c = True){
  8. system.debug(logginglevel.debug, 'DEBUG: lOCK' );
  9. lstAccount.add(soAccount);
  10.  
  11. Approval.LockResult[] lrList = Approval.lock(lstAccount, false);
  12.  
  13. } else If (soAccount.ISLock__c = False){
  14.  
  15. system.debug(logginglevel.debug, 'DEBUG: uNlOCK' );
  16. lstAccount.add(soAccount);
  17.  
  18. Approval.UnlockResult[] lrList1 = Approval.unlock(lstAccount);
  19.  
  20. }
  21. }
  22.  
  23. }
Add Comment
Please, Sign In to add comment