function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Roshan 10Roshan 10 

How to get the inserted record as an object when using the <lightning:recordForm> in the JavaScript controller?

This is the link for the documentation for <lightning:recordForm> 
https://developer.salesforce.com/docs/component-library/bundle/lightning:recordForm/documentation

The example shows how to get the record Id using event.getParam("id") in the handleSuccess JavaScript function.
How can I get the inserted record.
for ex: If I am creating a new Account record how can I get that entire record so that I can directly pass it to an event attribute
AnudeepAnudeep (Salesforce Developers) 
Hi Roshan, 

The onsuccess event returns the record object, including the ID of the newly created account
 
{  
      
    handleSuccess : function(component, event, helper) {  
          
        var params = event.getParams();  
        alert(params.id);  
          
    }  
      
})

Anudeep


 
Roshan 10Roshan 10
Hi Anudeep,

Can you provide the function to extract the record similar to the example you provided to retrieve the Id

var params = event.getParams(); 
alert(params.id);

Thanks,
Roshan