Advertisement
Guest User

Untitled

a guest
Oct 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. //Used to queue the updating of a list of SObjects
  2.  
  3. //Usage:
  4. //ID jobID = System.enqueueJob(new AsynchObjectsUpdate(<SOBJECTSTOUPDATE>));
  5.  
  6. public class AsynchObjectsUpdate implements Queueable {
  7.  
  8. List < SObject > objectsToUpdate;
  9.  
  10. //list constructor
  11. public AsynchObjectsUpdate(List < SObject > objects) {
  12. this.objectsToUpdate = objects;
  13. }
  14.  
  15. //single object constructor
  16. public AsynchObjectsUpdate( SObject objectToUpdate) {
  17. this.objectsToUpdate = new List < SObject >();
  18. this.objectsToUpdate.add(objectToUpdate);
  19. }
  20.  
  21.  
  22. public void execute (QueueableContext context) {
  23. system.debug('objectsBeingUpdated'+ objectsToUpdate);
  24. update objectsToUpdate;
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement