Posts

Showing posts from June, 2017

Lightning Data Service - Salesforce new Apex alternative - Part 2

Image
We have looked on some basic code for Loading and Updating a record using Lightning Design System in my last blog post. Here we are going to work on creating and deleting a record in Lightning Component using Lightning Design System. 1. Creating a Record: For creating a new record using LDS we declare force:recordData without assigning a recordId unlike what we use to do with Load and Update record. And then we load a record template by calling the getNewRecord function on force:recordData and finally we handle saving data using saveRecord in our 'handleSaveRecord' function. Lightning Components Developer guide already have some basic code on creating a Contact record ( Reference Link ). We are going to extend that code a bit to first create a new Account record and then create a new Contact record by linking it to the Account that we created all in one single shot. Below we are going to create a new Lighting Component from Developer Console by navigating to File...

Lightning Data Service - Salesforce new Apex alternative - Part 1

Image
Lightning Data Service which is currently in Beta are Salesforce new alternative of using Apex in Lightning Components. Basically we can perform View, Save, Update, and Delete of any sObject record in Lightning Components without using Apex Code! Lightning Data Service also respect org sharing rules and FLS settings, records that are loaded in LDS are cached and shared across components and components accessing same record see significant performance change, since the record is loaded only once and it doesn't matter how many components are using it. When one component updates a record, the other component using it are notified and refresh it automatically. Resource Link: Lightning Data Service Lets have a look at how Lightning Data Service works in Lightning Components. 1. Loading a Record: This is the foremost simplest that we can do using LDS. Here force:recordData tag is what we use in our component and that is the key for our component to load record. Every force:...

Salesforce Platform Events a plus to Integration Technique

Image
Platform Events are new Salesforce publish-subscribe modal available from Summer '17 release. Salesforce platform is already powerful having Outbound Messaging, REST API, and Streaming API available and with this new Platform Events it makes it even better and reduces need of having point-to-point integrations. Resource Links: 1. Platform Events Developer Guide Link 2. Here is an awesome blog post Link from Christopher Marzilli with detailed explanation about Platform Events Lets see how platform events work with a small implementation: Step 1: In Lightning experience Platform Events can be accessed using Setup-->Data-->Platform Events and here we are going to create a custom Text_Message platform event which is very similar on how we create custom objects, the only difference that we see in the API name is that all platform events end with '__e'. Also I have two custom fields (Message_Id__c, and Message_Type__c) to process message related call. Pub...

Summer ’17 Salesforce Two New Cool Lightning Features

Image
With new Summer '17 release Salesforce introduced some new cool features for Lightning, I really liked below two features and they are my top pick for this blog posting 1. Standard Action Overrides 2. Lightning Data Service (Currently in Beta) Here is the Link for the article from Salesforce that has detailed explanation on each of these new features . Standard Action Overrides: Until Summer '17 release we only had an option to override standard actions with visualforce page but now we have an new option to override any of these four standard actions (New, View, Edit and Tab) with a custom lightning component, just by using one powerful line of code "lightning:actionOverride" . Lets just create a sample Lightning Component to override Account standard actions. Below is my Lightning Component Code: <aura:component implements="lightning:actionOverride,force:hasSObjectName,force:hasRecordId"> <aura:if isTrue="{!v.sObjectName...