Skip to main content

Property Component

Zuora

Property Component

The PropertyComponent is a dynamic, customizable UI component that displays a detailed view of an object properties and allows creation and editing of objects. You might use the component, for instance, to display a page of subscription details.

The property component view is constructed with field sets on sObjects in Salesforce. You can create display sections, add fields to any section, re-order fields, show or hide fields, and make fields required or optional.

The Layout Configuration Settings page on the Zuora Config tab is used for configuring the property component display:

  • Configure property component for different object types, view types, and record types.
  • Configure section visibility, sequence, collapsibility, column count, and header visibility.

Using the plug-in architecture, you can customize the default values and how changes are saved.

The PropertyComponent is available in the Versions 5.100 and later of Zuora Quotes.

The PropertyComponent consists of:

  • PropertyComponent.component: The Visualforce UI component. 
  • PropertyComponentController.class: The Apex controller class for the PropertyComponent UI component. This class contains mechanisms for communicating with the controller class of the page that embeds the component. These mechanisms are described below. 
  • PropertyComponentOptions.class: The Apex class that stores the configuration options specified by the developer and used by the controller to render the component. 

PropertyComponent Component

The following is the syntax of the PropertyComponent:


<apex:component allowDML="true" access="global" layout="none"controller="PropertyComponentController">  
   <apex:attribute name="options" 
      assignTo="{!theOptions}" 
      access="global" 
      type="PropertyComponentOptions" 
      description="The PropertyComponent's configuration options." />  
   <!-- ...rest of component... -->
</apex:component>

PropertyComponent Attributes

The PropertyComponent has the following attributes.

Attribute  Type Description
backButtonLabel String Label for the back button
cancelButtonLabel String Label for the cancel button
id String An identifier that allows the component to be referenced by other components on the page

options

PropertyComponentOptions

The property component configuration options, as defined in the Component Options section below

rendered Boolean Specifies whether the component is rendered on the page. If not specified, this value defaults to true.
saveButtonLabel String Label for the save button

Embed PropertyComponent on a Visualforce Page

The following are the requirements you need to comply when embedding the PropertyComponents on a Visualforce page:

  • The PropertyComponent includes an attribute, options, which is an instance of the PropertyComponentOptions class that specifies the component configuration. The PropertyComponentOptions object must be built in an Apex class that is the controller (or extension) of the page containing the PropertyComponent.
  • The PropertyComponent must be placed within <apex:form> tags on Apex pages as the component uses <apex:pageBlockSection/> and <apex:pageBlockSectionItem/> which must be wrapped in <apex:form>.

PropertyComponentOptions Class

The PropertyComponent can be configured by constructing an instance of the PropertyComponentOptions class as a public property of your page controller and setting its options.

PropertyComponentOptions Properties

The PropertyComponentOptions class has the following properties.

Property Type Default Description
cancelPlugin String The default implementation of this plug-in

The fully-qualified class name of the custom implementation of this plug-in.

If your implementation is named "MyPlugin" and is an inner class of "SomeClass", then this should be set to "SomeClass.MyPlugin".

customRenderingFields Set<String> n/a

A string set which contains all the custom rendering fields name.

The field names in the set must include a namespace prefix.

Fields in this set are not rendered by the PropertyComponent. You must complete the rendering logic on the Apex page and add it as the body of component.

goBackPlugin String The default implementation of this plug-in

The fully-qualified class name of the custom implementation of this plug-in

hiddenFields Set<String> An empty set

A set of field names to explicitly exclude from the view

instanceName String propertyComponent

A custom name of the PropertyComponent instance.

The name can include letters, underscores, and numbers, but no other characters. Also, it cannot start with a number.

Only needs to be set when using multiple PropertyComponents on a single page.

isEditMode Boolean false

True if it is in the 'Create' or 'Edit' view.

False in the 'Detail' view. 

lookupFields Map n/a

A Map<String, LookupComponentOptions> with field name as key and the LookupComponentOptions instance as value.

The field name must have a namespace prefix.

The field in this map will be rendered by the LookupComponent custom component. Otherwise, lookup type fields are rendered by Salesforce.

notificationOptions NotificationOptions n/a

Configuration options for the Notification component embedded within this property component

objectId String n/a When using the component for the 'Create' view type, do not set the objectId, since in the creation view, the id of this record doesn't exist.
When using the component for the 'Detail' or 'Edit' view type, set the record id as objectId, then all the record information will be queried out, and shown in the property view.
objectName String n/a

The name of the sObject whose fields will be displayed in the PropertyComponent.

The object name must contain a namespace prefix.

Required.

parentController PropertyComponetController n/a

Contains an instance of the PropertyComponentController.ParentController. 

When using the PropertyComponent on a page, the Apex controller (or extension) of that page should extend the PropertyComponentController.ParentController class, then assign itself to this property when the options are being set.

Required.

populateValuePlugin String The default implementation of this plug-in

The fully-qualified class name of the custom implementation of this plug-in

propertyPageTitle String n/a The title of the property view page block
readonlyFields Set<String> n/a

A string set which contains all the read-only fields names.

The field names in the set must include a namespace prefix.

recordTypeId String n/a

You can configure the property component for different record types of an object, and the different record types can have different property views.

Get the record type ID from sobjectType.getDescribe().getRecordTypeInfosByName(), then pass it to this attribute.

Required.

relatedObjectPlugin String The default implementation of this plug-in

The fully-qualified class name of the custom implementation of this plug-in

renderBackButton Boolean false

If set to true, an additional Back button will be rendered for the component.

renderButtonBar Boolean true Specifies whether to show the default buttons for the property component, Save and Cancel. 
renderNotification Boolean true

If set to false, the notification component embedded within this property component is not rendered.

updatePlugin String The default implementation of this plug-in

The fully-qualified class name of the custom implementation of this plug-in

viewType String n/a

The property component support three types of view type now : Create, Edit, Detail.

There are static final strings in ViewConfigurationManager(
VIEW_CONFIGURATION_VIEW_TYPE_CREATE,
VIEW_CONFIGURATION_VIEW_TYPE_EDIT,
VIEW_CONFIGURATION_VIEW_TYPE_DETAIL,
VIEW_CONFIGURATION_VIEW_TYPE_LOOKUP).

Avoid using hard-coded view type strings if possible.

Required.

PropertyComponentController Class

PropertyComponentController Plugins

The PropertyComponentController exposes the following interface classes that can be implemented to handle actions a user can perform with the PropertyComponent:

  • Populate Default Values
  • Setup Related Objects
  • Update
  • Cancel 
  • Back

The concrete implementations of these interfaces are placed in your page controller (or any other class) and their names are passed to the PropertyComponentOptions object as Strings at runtime. 

PropertyComponentController.IPopulateValuePlugin

The IPopulateValuePlugin allows you to populate default values for specific fields. For example, in content of the method, use record.put(fieldName, value) to populate field default value. You can also get information from the current PropertyComponentController since it has been passed from the argument.

Interface Class Signature

void populateDefaultFieldValue (SObject record, PropertyComponentController.ParentController parentController)

PropertyComponentController.IRelatedObjectPlugin

The IRelatedObjectPlugin sets desfault values for the referenced field although in the 'Create' view, the record hasn't existed yet. This plug-in is only for the 'Create' view type.

The plug-in returns a map with relationship name as key and object as value. For example:

Map<String, SObject> relatedObjectMap = new Map<String, SObject>();
relatedObjectMap.put('Opportunity__r',opportunityObject);
return relatedObjectMap;  
Interface Class Signature

Map<String, SObjectgetRelatedObject (PropertyComponentController.ParentController parentController)

PropertyComponentController.IUpdatePlugin

The IUpdatePlugin contains the custom saving logic to be executed when user clicks the Save button. The plug-in returns the page it should be navigated to after saving .

Interface Class Signature

PageReference doUpdate (SObject record, PropertyComponentController.ParentController parentController)

PropertyComponentController.ICancelPlugin

The ICancelPlugin contains the custom cancelation logic to be executed when user clicks the Cancel button. The plug-in returns the page it should be navigated to after cancelation.

Interface Class Signature

PageReference doCancel (SObject record, PropertyComponentController.ParentController parentController)

PropertyComponentController.IGoBackPlugin

The IGoBackPlugin contains the custom logic to be executed when user clicks the Back button. The plug-in returns the page that the user should be redirected to.

This plug-in is used in the Quote Wizard.

Interface Class Signature

PageReference goBack (SObject record, PropertyComponent.ParentController parentController)