global with sharing class DefaultForm implements B25.Form.Customizer {
global void customize(Form form) {
form.getField(B25__Reservation__c.B25__Title__c).onUpdate(new CopyFieldHandler());
}
global class CopyFieldHandler extends B25.FormEventHandler {
global override void handleEvent(B25.FormEvent event, B25.Form form) {
B25.FormRecord activeRecord = form.getActiveRecord();
Object titleValue = activeRecord.get(B25__Reservation__c.B25__Title__c);
if (form.hasParentRecord()) {
B25.FormRecord parentRecord = form.getParentRecord();
if (parentRecord != activeRecord) {
parentRecord.put(B25__Reservation__c.B25__Title__c, titleValue);
}
}
if (form.hasChildRecords()) {
for (FormRecord childRecord : form.getChildRecords()) {
if (childRecord != activeRecord) {
childRecord.put(B25__Reservation__c.B25__Title__c, titleValue);
}
}
}
}
}
} |