Represents a record on the form. Contains a reference to the actual SObject.
You can get a reference to the active record (the one currently being viewed/edited) by calling getActiveRecord()
on a B25.Form instance.
CODE
global with sharing class ExampleHandler extends B25.FormEventHandler {
global override void handleEvent(B25.FormEvent event, B25.Form form) {
// set the title of the current record
form.getActiveRecord().put(B25__Reservation__c.B25__Title__c, 'Hello World');
}
}
CODE
SObject getSObjectClone()
Returns a clone of the SObject record. Note that modifications to this record will not be reflected on the form. In order to do that, use the put
method instead.
Return value: SObject
CODE
void put(SObjectField fieldToken, Object value)
Sets the specified field on the record to the specified value, and updates the field on the form. Does not trigger any handlers that have been added to the field.
CODE
void put(SObjectField fieldToken, Object value, Boolean triggerChangeHandlers)
Same as put(SObjectField, Object)
above, but with an additional Boolean parameter that can be set to true in order to trigger any handlers that have been added to the field.
CODE
Object get(SObjectField fieldToken)
Returns the record’s current value of the specified field.
You can cast this to another type for further use. For example, in the example below we cast the Object to an Id, which enables us to query additional fields.
CODE
B25.FormRecord newRecord = form.getActiveRecord();
Id accountId = (Id)newRecord.get(B25__Reservation__c.B25__Account__c); //Returns an Id so you could potentially query more fields from Account
CODE
B25.FormRecordCollection getRelatedRecords(String relationshipName)
Returns all the records related to this FormRecord (wrapped in a B25.FormRecordCollection object) for a specific relationship name. The relationship name can be found on the lookup from the child record to the parent record. For example, to get all the reservation contacts of a reservation, the relationship name is ‘B25__Reservation_Contacts__r’.
CODE
B25.FormRecordCollection getRelatedRecords(ChildRelationship relationship)
Same as getRelatedRecords(String)
above, but takes a Schema.ChildRelationship as input rather than a String. You can obtain ChildRelationships from an SObjectDescribe instance:
CODE
List<Schema.ChildRelationship> relationships = Account.SObjectType.getDescribe().getChildRelationships();