Skip to content

Instantly share code, notes, and snippets.

@jsmithdev
Created November 1, 2019 21:35
Show Gist options
  • Save jsmithdev/250172702e8118c91c411364866af544 to your computer and use it in GitHub Desktop.
Save jsmithdev/250172702e8118c91c411364866af544 to your computer and use it in GitHub Desktop.
Apex: tiny example util for lock / unlock files
//from https://github.com/mshanemc/processBuilderBlocks
public with sharing class Util_Locker {
public static void LockRecord(list<string> recordIds) {
Approval.lock( dedupe(recordIds) );
}
public static void UnLockRecord(list<string> recordIds) {
Approval.unlock( dedupe(recordIds) );
}
public static list<string> dedupe(list<string> input){
set<string> temp = new set<string>(input);
return new list<string>(temp);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment