Editing Salesforce Objects in Custom Lightning Components With NO JAVASCRIPT

by Aidan Harding - January 19, 2018

When it comes to writing custom user-interface code in Salesforce, Lightning is where it’s at. You could write it in Visualforce, but sooner or later you’ll have to convert it to Lightning. Lightning provides a far richer experience. It allows you to view related data more easily, and see that data change in real-time.

One headache for developers has been that doing something like writing a component to update values on a Contact would require page markup, Javascript, and Apex. And Salesforce itself did not check whether the current user had the correct permissions to be viewing/editing this data. Security was an extra requirement that could easily be forgotten.

In Visualforce, the same requirements could all be achieved with a small amount of markup, leveraging built-in Visualforce tags.

Well, as of Spring ’18, Lightning can now achieve the same thing. The combination of two new components, lightning:recordEditForm and lightning:inputField handle all the complexity for us, and we can get on with only writing custom code where it really adds value to the business!

Editing a Contact in Lightning is now as simple as:

<lightning:recordEditForm recordId=”0030Y0000080eMuQAI” objectApiName=”Contact”>
<div class=”slds-box slds-theme_default”>
<lightning:messages />
<lightning:inputField fieldName=”Name” />
<lightning:inputField fieldName=”Phone”/>
<lightning:inputField fieldName=”Email” />
 <lightning:button class=”slds-m-top_small” variant=”brand” type=”submit” name=”update” label=”Update” />

Build Secure and Interactive Forms Faster…No custom JavaScript and no Apex needed!

Related Content

Get In Touch

Whatever the size and sector of your business, we can help you to succeed throughout the customer journey, designing, creating and looking after the right CRM solution for your organisation