Blog Medium Image

  • Salesforce Spring ’19 Release Features The Salesforce Spring ’19 Release is here, and you’ll now be able to explore the exciting new features and upgrades of the newest release. Here is a quick overview of Salesforce Spring ‘19 release date, our most loved features in the Salesforce Spring ’19 Release, like the advanced Lightning Experience […]

    Read More

  • Lightning Message Service

    Information :-

    Lightning Message Service (LMS) allow us to communicate between visualforce and Lightning component(Aura and Lightning web component both) on any lightning page.

    LMS API allow you to publish message throughout the lightning experience and subscribe the same message anywhere with in lightning page. It is similar to Aura Application Events to communication happens between components.

    Lightning Message Service is based on a new metadata type: Lightning Message Channels. We need to use Lightning Message Channel to access the Lightning Message Service API.

    1. In LWC we can access Lightning Message Channel with the scoped module @salesforce/messageChannel.

    2. In Visualforce, we can use global variable $MessageChannel.

    3. In Aura, use lightning:messageChannel in your component

    When to use Lightning Message Service :-

    In Lightning Experience, if we want a Visualforce page to communicate with a Lightning web component then we have to implement a custom publish-subscribe solution because this is currently not possible with LWC Event. Now, we can use the Lightning Message Service API to handle this communication.

    Steps to create Lightning Message Service :-

    • Create a message channel called SampleMessageChannel__c using the Metadata API.
    • Create a Lightning web component called publisherComponent that publishes on SampleMessageChannel__c message channel.

    The publisherComponent code is :-

    // publisherComponent.js

    import { LightningElement, wire } from ‘lwc’;

    import { publish, MessageContext } from ‘lightning/messageService’;

    import SAMPLEMC from “@salesforce/messageChannel/SampleMessageChannel__c”;

    export default class PublisherComponent extends LightningElement {



       handleClick() {

            const message = {

                recordId: “Any string”,

                recordData: {

                 value: “any data”



            publish(this.messageContext, SAMPLEMC, message);



    In HTML template file of component includes a Publish button that calls the handleClick() method. OnClick of that button it publishes the record data to SampleMessageChannel__c. The subscribing Visualforce page then receives that data.

    publisherComponent.html Code :-


        <lightning-card title=”MyLwcPublisher” icon-name=”custom:custom14″>

            <div class=”slds-m-around_medium”>

                <p>MessageChannel: SampleMessageChannel</p>


                <lightning-button label=”Publish” onclick={handleClick}></lightning-button>




    Lightning web component Code :-



            <p>Subscribe to SampleMessageChannel</p>

            <button onclick=”subscribeMC()”>Subscribe</button>

            <p>Unsubscribe from SampleMessageChannel</p>

            <button onclick=”unsubscribeMC()”>Unsubscribe</button>



            <p>Received message:</p>

            <textarea id=”MCMessageTextAreaId” rows=”10″                        style=”disabled:true;resize:none;width:100%;”/>



            // Load the MessageChannel token in a variable

            var SAMPLEMC = “{!$MessageChannel.SampleMessageChannel__c}”;

            var subscriptionToMC;

            function onMCPublished(message) {

                var textArea = document.querySelector(“#MCMessageTextAreaId”);

                textArea.innerHTML = message ? JSON.stringify(message, null, ‘\t’) : ‘no message payload’;


            function subscribeMC() {

                if (!subscriptionToMC) {

                    subscriptionToMC =, onMCPublished, {scope: “APPLICATION”});



            function unsubscribeMC() {

                if (subscriptionToMC) {


                    subscriptionToMC = null;





  • Take your related lists to the next level. With Enhanced Related Lists, you can show up to 10 columns, resize and sort your columns, perform mass actions, and wrap text. We can display maximum 10 fields on the related list record. Default ordering is by RecordID. We can sort by any number of fields on […]

    Read More

  • Create a Lightning Component via your developer console or through your IDE. Let’s say the name of your Lightning component is “Accordion.cmp” . It’s relevant controller and other helper classes will be created. Use the below-mentioned code in your Lightning component which will show the data in expand and collapse section which contains three sections  […]

    Read More

  • Display a preview of content document or salesforce files dynamically in salesforce lightning component using <lightning:fileCard> base component. A <lightning:fileCard> component displays a preview of a file (Image, Text, PDF…etc.). On desktops, clicking the file preview opens the SVG file preview player, enabling you to preview images, documents, and other files in the browser. The […]

    Read More

  • What is Pagination? Pagination is the process of taking a complete a large number of records breaking that large number of records into separate pages for viewing within the Salesforce. What is use of Pagination in salesforce? Pagination is a useful thing with the salesforce.Taking an example to better understanding about pagination. Let’s say we […]

    Read More

  • Lightning- data table component displays tabular data where each column can be displayed based on the data type. lightning: data table is not supported on mobile devices. Supported features : ❖  Displaying and formatting of columns with appropriate data types ❖  Infinite scrolling of rows ❖  Inline editing for some data types ❖  Header-level actions ❖  Row-level actions ❖  […]

    Read More

  • User Permission : User Permission specify what action user can perform and what feature user can access.Permission set controls the access of users.User permission and access setting are specified in permission set and profiles. What is Difference between Profile and Permission Set : The Key Difference between Profile and permission set is that Profile is […]

    Read More

  • Lightning Login : Salesforce introduce Lightning Login, this has nothing related with Lightning Experience, and Lightning Login work with both Classic and Lightning Experience.     Lightning Login was brought out in Winter ’17 and allows your users to login to Salesforce without a password, but their fingerprint.  This is one of many features that Salesforce is […]

    Read More

Post A Comment