Generic Record Handler Lightning Component

Generic Record Handler Lightning Component

In this blog, we will develop a generic record handler lightning component, which will be helpful in viewing and editing any record of any object.

This component is developed using very helpful base lightning components,  lightning:datatable and lightning:recordForm. It will be helpful in:

  • Viewing any object in your Salesforce Org.
  • Viewing and editing records of the selected object from the same page. This works for both standard and custom object.

You can replace the datatable used in this example with a paginated datatable, which I have explained in below blogs.

Code Time

GenericRecordHandler.cmp – Lightning Component



GenericRecordHandlerController.js – Controller



GenericRecordHandlerHelper.js – Helper



GenericRecordHandler.apxc – Apex Controller



 

Output

There are lot of modification can be done in this component as per your use case. Like having a paginated data-table, suppying filter in SOQL instead of fetching 200 records etc. Its totally upto you how you would use this component. Paste your query in the comments.

Manish Choudhari

I am a certified Salesforce Application & System Architect and Developer working on Salesforce Technology since 2014. Currently, I have 14 Salesforce certifications along with OCPJP (Oracle Certified Profession JavaSE6 Programmer) working in Salesforce.com Hyderabad as a Technical Engineer. Writing technical blogs, learning new technologies and frameworks and sharing knowledge is my hobby.

This Post Has 8 Comments

  1. Avatar

    “Generic Record Handler Lightning Component” that you created is really awesome.
    Thank you for all your useful blogs related to lightning.

  2. Avatar

    Hi,

    Nice!!. Is there any way to update multiple records at a time?
    Thanks,
    Rama

  3. Avatar

    Manish – I am new to SF and ligntning (no Java / CCS). I seen you few lightning vdios and they look good but can you please let me who how to start from begining so that I can learh more objectively and also when I can download the classes material to cpmpare

    hitesh.patel.vab@gmail.com

    Hare Krishan

  4. Avatar

    Hi ,
    Nice! . Is there any way to delete the record?

    1. Avatar

      That is good idea. In this example you cannot delete the record this way, but this can be modified to include delete functionality as well.

  5. Avatar

    i am new to lightning can i get the example to display the selected record detail page from list of records of any object

Leave a Reply

Close Menu