Salesforce Lightning Component framework is a UI framework for developing dynamic apps for mobile and desktop devices. It’s a modern framework for building single-page applications engineered for growth. Salesforce Lightning makes it easier to build responsive applications for any device. In the earlier blog ‘Retrieve Records via Lightning’, we discussed how to read records from Salesforce and display them via Lightning. Now taking a step ahead, get insights on how to save a record in Salesforce database using Lightning.
Open the developer console. The developer console as we already know is preferred to create Lightning components, controller and apps to preview the functionality. We created a Lightning component named ‘Lightning_SaveRec’ in our developer console which will be used in the Lightning App. First, we write a function in our apex class that would implement the functionality of saving the records, ensure that your method is annotated with ‘@AuraEnabled’. Here’s the snippet for the Apex class handling the functionality of inserting/saving records in Salesforce.
Now, we need to create a Lightning component which will be using this controller. In your developer console create a new Lightning component. Refer the image below regarding the code snippet for your Lightning component –
Lightning Helper class-
The CSS used in our Lightning component can be downloaded from this link, download SLDS090. Applying the CSS is optional. After downloading the mentioned zip file just upload it in static resources of Salesforce. After implying all the above mentioned steps, just refer the Lightning component in your Lightning app. Once done, just click on “Preview” and then you can view your Lightning App. Once the page is displayed, you can enter the records you want and click on “Submit” button. This will create a new record in your Salesforce SObject.
Greytrix as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offers Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.
Greytrix has some unique solutions for Cloud CRM such as Salesforce integration with Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data Migration, Integrated App development, Custom App development and Technical Support to business partners and end users.
Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star app listed on Salesforce AppExchange.
For more information, please contact us at email@example.com. We will be glad to assist you.