A wrapper around a collection of B25.FormRecords, with some additional methods to manipulate the collection.
This class implements the Iterator interface. This makes it act like a List<B25.FormRecord> and allows you to loop over the collection, for example this code demonstrates setting the checked in time on every reservation contact:
CODE
B25.FormRecord record = form.getActiveRecord();
B25.FormRecordCollection reservationContacts = record.getRelatedRecords('B25__Reservation_Contacts__r');
for (B25.FormRecord reservationContact : reservationContacts) {
reservationContact.put(B25__ReservationContact__c.B25__Check_In_Datetime__c, System.now());
}
The following code demonstrates adding a reservation contact from inside an B25.FormEventHandler
CODE
B25.FormRecord record = form.getActiveRecord();
B25.FormRecordCollection reservationContacts = record.getRelatedRecords('B25__Reservation_Contacts__r');
Id contactId = [SELECT Id FROM Contact LIMIT 1].Id; // just grab a random contact id for this example
Id reservationId = record.getSObjectClone().Id;
reservationContacts.add(new B25__ReservationContact__c(
B25__Contact_Lookup__c = contactId,
B25__Reservation_Lookup__c = reservationId
));
CODE
B25.FormRecord get(String UUID)
Gets the record from the collection with the specified identifier.
Return value: B25.FormRecord
Throws: B25.FormRecordCollectionException if the collection does not contain a record with the specified identifier.
CODE
void remove(B25.FormRecord toRemove)
Removes the specified B25.FormRecord from the collection.
CODE
B25.FormRecord add(SObject recordToAdd)
Wraps the given SObject record in a B25.FormRecord, adds it to the collection, and returns the wrapped record.
Return value: B25.FormRecord
Throws: B25.RelatedListItem.SObjectTypeException if record being added does not match the SObjectType of this collection.
CODE
Iterator<B25.FormRecord> iterator()
Returns an iterator over the wrapped B25.FormRecords for this collection.
Return value: Iterator