Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Overview
Excerpt |
---|
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 Block |
---|
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());
} |
Example
The following code demonstrates adding a reservation contact from inside an B25.FormEventHandler
Code Block |
---|
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 )); |
Methods
get(String)
Code Block |
---|
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.
remove(B25.FormRecord)
Code Block |
---|
void remove(B25.FormRecord toRemove) |
Removes the specified B25.FormRecord from the collection.
add(SObject)
Code Block |
---|
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.
iterator()
Code Block |
---|
Iterator<B25.FormRecord> iterator() |
Returns an iterator over the wrapped B25.FormRecords for this collection.
Return value: Iterator
On this page | |
---|---|
|