fork download
  1. global class BatchHandlerForUpdateSequenceinCAPAGT implements Database.Batchable<sObject> {
  2. global Database.QueryLocator start(Database.BatchableContext BC) {
  3. String query = 'select id,Record_Type_Name__c,Sequence__c,Adhoc_Sequence__c,Sequence_Position__c from General_Task__c where CAPA__c!=NULL';
  4. return Database.getQueryLocator(query);
  5. }
  6. global void execute(Database.BatchableContext BC, List<General_Task__c> genTasks) {
  7. for(General_Task__c gtask:genTasks){
  8. if(gtask.Record_Type_Name__c != 'AdhocTask'){
  9. if(String.isBlank(gtask.Sequence__c)){
  10. gtask.Sequence__c=String.valueof(integer.valueof(gtask.Sequence_Position__c));
  11. }
  12. }else {
  13. if(String.isBlank(gtask.Adhoc_Sequence__c)){
  14. gtask.Adhoc_Sequence__c=String.valueof(integer.valueof(gtask.Sequence_Position__c));
  15. }
  16. }
  17. }
  18. try {
  19. update genTasks;
  20. } catch(Exception e) {
  21. System.debug(e);
  22. }
  23. }
  24. global void finish(Database.BatchableContext BC) {
  25. // execute any post-processing operations
  26. }
  27. }
  28.  
Success #stdin #stdout #stderr 0.01s 8872KB
stdin
Standard input is empty
stdout
Object: UndefinedObject error: did not understand #BatchHandlerForUpdateSequenceinCAPAGT
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject class(Object)>>doesNotUnderstand: #BatchHandlerForUpdateSequenceinCAPAGT (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:1: expected expression
./prog:8: expected expression