About Object Extensions

A Form Extension can serve as either a Form Extension or an Object Extension that will fire on all Forms of a single Object. An Object Extension is developed and configured in the same way as a Form Extension except for the following differences:

  1. The has extension controls checkbox on the Object must be checked. Note: the initial release of 2006.02 neglected to place this control on the designed form. Therefore you must update this from within SQL:
    UPDATE md_object SET obj_has_extensions = 1 WHERE obj_key='xxxxxx'
  2. Go to any Form of the Object and add a Form Extension. First save the form extension, then edit it and go to the advanced page, select the Object to which the form belongs, and set the Form to be blank:

  3. For the method definition in the Form Extension, set the parameters to be Facade:Facade as shown here:

  4. The .NET code for the Form Extension should not follow the typical pattern of passing in a PageClass and System.Web.UI.Control parameter. Instead, to match up with the Facade:Facade parameter as described in the step above, pass in a FacadeClass as in:
public void CommitteeParticipantBeforeSave(FacadeClass oFacade)

{

DateTime dtFrom = System.Convert.ToDateTime(oFacade.GetValue("cmc_start_date"));

DateTime dtThru = System.Convert.ToDateTime(oFacade.GetValue("cmc_end_date"));

if (dtFrom > dtThru)

{

ErrorClass oEr = new ErrorClass();

oEr.Number = (int)ErrorClass.ErrorNumber.GeneralError;

oEr.Message = "From Date must be before Through Date";

oEr.Level = ErrorClass.ErrorLevel.Error;

Config.LastError = oEr;

Config.LastError.Display();

}

}

Limitations of Object Extensions

  • Object Extensions work only on Forms. Does not fire when the object is run in code or from xWeb.
  • Works only in netFORUM build 2006.02 and later.
  • If you have an Object Extension on the Address Object, but a user edits an address on a Form based on the Individual object, your Object Extension will NOT fire. Workaround: add Object extension to Individual and see if you can call your original object extension on the Address. In reality, an Object Extension is really a "Form Extension that works on all Forms for that Object." The main benefit of the Object Extension is that you have to set up the metadata only once, and you do not have to worry about going to every form of that object and putting the form control on the object and checking the "has extensions" checkbox for every form. Just be aware of the limitations of an Object Extension and design your solution accordingly.