Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
global with sharing class MyCustomPublisher implements System.Callable {
    
    public Object call(String action, Map<String, Object> args) {
                
        // get the template and query additional fields
        B25__Reservation_Template__c template = (B25__Reservation_Template__c) args.get('template');
        template = [
            SELECT B25__Staff__c, B25__Resource__c 
            FROM B25__Reservation_Template__c
            WHERE Id = :template.Id
        ];

		// get the reservation and modify it        
        B25__Reservation__c reservation = (B25__Reservation__c) args.get('reservation');
        reservation.B25__Resource__c = template.B25__Resource__c;
        reservation.B25__Staff__c = template.B25__Staff__c;
        reservation.B25__Title__c = 'This reservation was created by MyCustomPublisher';
        
        return reservation;        
    }
}