In-line Editing Visualforce Component for Any Object

This is a Visualforce component for in-line editing of an object’s child or related records. It will work for most Salesforce standard and custom objects. Pass in parameters to change what is displayed and if the user can add, edit, or delete records.

In-line Editing Visualforce Component for any object

Required Parameters

  • aParentRecId: Parent Record Id. This is used to select the related object’s records.
  • aRelationField: Field that refers back to the parent. This field is used in the query where condition with the Parent Record Id.
  • asObjectType: Type of child Object.
  • aFieldList: List of fields to display in the pageBlockTable.

Optional Parameters

  • aAllowAdd: Ability to add new records. The Add button will display.
  • aAllowEdit: Ability to edit records. The Edit link will display.
  • aAllowDelete: Ability to delete records. The Del link will display.
  • aLabelOverrideFieldList: List of fields with overridden labels.
  • aLabelOverrideTextList: List of text that overrides the field labels.
  • aDefaultValueFieldList: List of fields used to set default values on added records.
  • aDefaultValueTextList: List of text used to set default values on added records.
  • aBlockTitle: Page block title text.

MultiRecordComponent.component

MultiRecordComponentController.cls

ExamplePage1.page

ExamplePage1Controller

7 thoughts on “In-line Editing Visualforce Component for Any Object

  1. This works great! Do you happen to have a test class written for the MultiRecordComponentController.cls though?

    Keep up the great work!

    • Thanks! No test class for it yet. I don’t want to hog all of the fun. If someone finds the component useful and wants to share a test class, I would happily post it.

  2. Dave,
    This component is exactly what I have been looking for to use for several Related Lists on my Quote page. I am new to VF and dont know how to implement. Would you happen to have some instructions that cater to greenbeans?

    • My recommendation is to copy and past the code from the two apex classes and two visualforce pages above, and then experiment with the different parameters. I think the best way for greenbeans is to build knowledge is to dive right in and start creating/modifying applications.

  3. I see in the Apex you reference JS – now do you save this as a static resource or is this something that SFDC reads and doesn’t need to have written in addition to the VF/Apex Controller? I am working though it to get a working copy in our sandbox and just want to understand once it is in our sandbox and we have a test class I will share back the entire sample 😉

    • No static resource is necessary. The DoDeleteJS references an apex:actionFunction which is one way Salesforce provides to execute a controller method with JavaScript.

Comments are closed.