Point and Click alternative to Lightning Data Service

You might be loving Lightning Data Service and its capabilities. It Creates an editable form or display form for a record. This component requires API version 43.0 and later. What if you are capable of doing the same thing without writing a single line of code. Yes, You can do that. How?

Lightning Experience Comes with Standard Component called Related Record Component which you can use to give your users the record details they need most. Use the Related Record component to customize your Lightning pages and display the details of a related record, including the parent record, on any record page. This feature is new in Lightning Experience.

Use Cases

Want to show details about an associated contact on a case? Want to show the details of a case’s parent case? To top it off, your users will love the built-in record creation, inline edit, and ability to unlink a record and link a new one.

Sample Related Record Component

How?

Under the covers, the component uses quick actions and global actions to create and update the records. If there are no actions available for your lookup, follow the links in the Lightning App Builder property editor to create the actions. You can select any associated lookup field to display related details—even lookups for custom objects.

Steps to Follow

Here, We are creating Action of type Update a record. You can create an action of type Create a record also as per requirement.

  1. In Setup, in the Quick Find box, enter the name of the object that you want to add actions to. For this example, enter Opportunities, then select Buttons, Links, and Actions.
  2. Click New Action to see which types of actions are available.
  3. From the Action Type dropdown list, select the action to add. In this case, select Update a Record.
  4. Enter a label and description for the action. undefined
  5. Click Save.The next page shows the default fields that you can update. For the example, add the Probability (%) and Typefields.
  6. Drag Probability (%) and Type below the Stage field in the workspace. To select multiple fields, hold down Ctrl (for Windows) or Cmd (for macOS). undefined
  7. Click Save.You added the Update Opportunity action to the Opportunities object.

Now, You have created the action. Its time to add the action to your Lightning page Layout using Lightning App Builder.

Adding the action to Lightning Page Layout

  1. In Salesforce, click the Opportunity tab. Click any record name. (If no records appear in the Recently Viewed list, change to the All Accounts list.) 
  2. Click the gear icon(setup), then select Edit Page to open the Lightning App Builder. 
  3. Drag the Related Record standard component from the Lightning Components list to the page and place it where ever you want on the canvas. undefined
  4. Click Save
  5. Click Activate
  6. Click Assign as Org Default, then click Save
  7. Click Back to return to the record home page. 

Now, we have added the action to Lightning page Layout. Its time to see how it works.

Component in View Mode
Component in Edit Mode

Any change in this component will be automatically reflected in record. That’s really great. Admins got more power now. Without writing a single line of code, You can create reusable Form to display a set of fields or create a record form and put it on Lightning Page.

Note:- All the validation rule, sharing setting and other standard features will be respected by this Component.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s