Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Trigger AccountLockRecord on Account (before insert, after update) {
- For (Account soAccount: Trigger.New){
- List<Account> lstAccount = new List<Account>();
- If (soAccount.ISLock__c = True){
- system.debug(logginglevel.debug, 'DEBUG: lOCK' );
- lstAccount.add(soAccount);
- Approval.LockResult[] lrList = Approval.lock(lstAccount, false);
- } else If (soAccount.ISLock__c = False){
- system.debug(logginglevel.debug, 'DEBUG: uNlOCK' );
- lstAccount.add(soAccount);
- Approval.UnlockResult[] lrList1 = Approval.unlock(lstAccount);
- }
- }
- }
Add Comment
Please, Sign In to add comment