• Introduction to Slack : Slack is the #1 communication platform for business thanks to how intuitive and seamless it is to connect team members in every industry. Features like search, shared channels, apps and integrations, and pinned items make it the go-to option for teams around the world.The Slackforce integration is not new, there have […]

    Read More

  • Lightning Message Service

    In this blog post, we would be creating Visualforce, Aura Component and Lightning Message Service and exchanging messages between all of them using Lightning Message Service.

    Introduction to Lightning Message Service

    • Introduced in the Winter ’20 release by Salesforce, Lightning Message Service is the out-of-the-box functionality that empowers you to communicate between Visualforce and Lightning Components, including Aura web components (AWC) and Lightning web components (LWC).
    • For an organization hesitant to migrate to Lightning Experience and its newer technologies, Aura Components and Lightning Web Components.
    • LMS may make the migration palatable. With LMS’s ability to communicate between Visualforce pages and lighting components, you can take a more disciplined approach to upgrading.
    • Instead of scraping existing Visualforce pages and creating new Lightning components, you can update existing Visualforce pages to interact with new Lightning components to provide new functionality.

    What is a Lightning Message Service?

    • LMS is defined as the standard publish-subscribe library that enables communication quickly and seamlessly with DOM across the Salesforce UI tech stack, including Visualforce Pages, Aura components, and Lightning Web Components (LWC) using simple API.
    • With this unique feature of Salesforce, you can publish messages and subscribe to them anywhere within the lightning page.
    • Lightning Message Service feature is similar to Aura application events that enable seamless communication between components.
    • Lightning Message Service is based on Lightning Message Channels, a new metadata type. 
    • Lightning Message Channel is used to access the Lightning Message Service API and Lightning Message Channel in LWC via scoped module @salesforce/messageChannel. When it comes to Visualforce, you can use the global variable $MessageChannel.
    • In Aura, you can use lightning:messageChannel in your component.

    Uses Of Lightning Message Service :

    • To enable communication between Visualforce page, Lightning web components, and Aura components, 
    • To access Lightning Message Service API for publishing messages throughout Lightning Experience.
    • It helps in subscribing to messages that originated from anywhere within Lightning Experience via Lightning Message Channel. 
    • A specific namespace is associated with Lightning Message Channel. Developers can choose whether they want their message channel to be available to other namespaces or not, ensuring the security of communication on Lightning Message Service.

    Lightning Message Channel :

    • It’s basically the name of Schema which will hold the actual message.
    • create file LMSDemoWin.messageChannel-meta.xml in folder messageChannels.

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <LightningMessageChannel xmlns=””>
       <masterLabel>LMS Demo</masterLabel>
       <description>Winter 20 – LMS Demo.</description> 

    Deploy Lightning Message Channel :

    • Run below SFDX command to deploy this message channel on your Salesforce Org.
    • Run push command to deploy message channel on Orgs.
    • Once, Lightning Message Channel is created, let’s start by creating components and first we will create below Visualforce Page.

        <!– Begin Default Content REMOVE THIS –>
        <h1>Lightning Message Services – Demo – Winter 20</h1>
            <p>Message To Send</p>
            <input type=”text” id=”vfMessage” />
            <button onclick=”publishMessage()”>Publish</button> 
            <button onclick=”subscribeMC()”>Subscribe</button> 
            <button onclick=”unsubscribeMC()”>Unsubscribe</button> 
            <p>Messages Received:</p>
            <textarea id=”txtMessages” rows=”2″ style=” width:100%;” />
            // Load the MessageChannel token in a variable
            var lmsDemoChannel = “{!$MessageChannel.LMSDemoWin__c}”;
            var subscriptionToMC;
           function publishMessage() {
                const payload = {
                    source: “Visualforce”,
                    messageBody: document.getElementById(‘vfMessage’).value
      , payload);
            function subscribeMC() {
                if (!subscriptionToMC) {
                    subscriptionToMC =, onMCPublished);
            function unsubscribeMC() {
                if (subscriptionToMC) {
                    subscriptionToMC = null;
            function onMCPublished(message) {
                var textArea = document.querySelector(“#txtMessages”);
                textArea.innerHTML = message ? ‘Message: ‘ + message.messageBody + ‘ From: ‘ + message.source : ‘no message payload’;
    • Next component we would build would be the Aura Component.

    <aura:component description=”testMessageAura” implements=”flexipage:availableForAllPageTypes” access=”global”>
        <aura:attribute type=”String” name=”myMessage”/>
        <aura:attribute type=”String” name=”receivedMessage”/>
        <lightning:messageChannel type=”LMSDemoWin__c” aura:id=”lmsDemohannel” onMessage=”{!c.handleReceiveMessage}”/>
        <lightning:card title=”Aura Component” iconName=”custom:custom18″>
            <div class=”slds-m-around_medium”>
                <lightning:input type=”text” value=”{!v.myMessage}” label=”Message To Send”/>
                <lightning:button label=”Publish” onclick=”{! c.handleClick}”/>
                <p>Latest Received Message</p>
                <lightning:formattedText value=”{!v.receivedMessage}”/>

    • Controller of Aura Component

        handleClick: function(component, event, helper) {
            let myMessage = component.get(“v.myMessage”);
            const payload = {
                source: “Aura Component”,
                messageBody: myMessage
        handleReceiveMessage: function (component, event, helper) {
            if (event != null) {
                const message = event.getParam(‘messageBody’);
                const source = event.getParam(‘source’);
                component.set(“v.receivedMessage”, ‘Message: ‘ + message + ‘. Sent From: ‘ + source);

    • Aura Component by default handles those operations once we declare them.
    • Last component we would be creating is the Lightning Web Component.

        <lightning-card title=”LWC” icon-name=”custom:custom18″>
            <div class=”slds-m-around_medium”>
                <lightning-input label=”Message To Send” type=”text” value={_msg} onchange={handleChange}></lightning-input>
                <lightning-button label=”Publish” onclick={handleClick}></lightning-button>
                <lightning-button label=”Subscribe” onclick={handleSubscribe}></lightning-button>
                <lightning-button label=”Unsubscribe” onclick={handleUnsubscribe}></lightning-button>
                <p> Message Received</p>
                <lightning-formatted-text value={receivedMessage}></lightning-formatted-text>
    • Javascript of LWC

    import { LightningElement, track} from ‘lwc’;
    import { publish,createMessageContext,releaseMessageContext, subscribe, unsubscribe } from ‘lightning/messageService’;
    import lmsDemoMC from “@salesforce/messageChannel/LMSDemoWin__c”;
    export default class LMS_MessageSenderReceiverLWC extends LightningElement {
        @track _msg = ”;
        @track receivedMessage = ”;
        context = createMessageContext();
        constructor() {
        handleSubscribe() {
            const parentPage = this;
   = subscribe(this.context, lmsDemoMC, function (event){
                if (event != null) {
                    const message = event.messageBody;
                    const source = event.source;
                    parentPage.receivedMessage = ‘Message: ‘ + message + ‘. Sent From: ‘ + source;
        handleUnsubscribe() {
        handleChange(event) { 
            this._msg =;
        handleClick() {  
            const payload = {
                source: “Lightnign Web Component”,
                messageBody: this._msg
            publish(this.context, lmsDemoMC, payload);
        disconnectedCallback() {

    • Once we embed all three components (Visualforce, Aura and Lightning Web Components), we would be able to see Lightning Message Service in action as shown in below image.

    Advantage of Lightning Message Service :

    • One of the significant benefits is increased development time. For instance, if a Visualforce Page or Lightning component tries to reference a message channel that is non-available and that message channel is not exposed, then the code would not compile. 
    • This messaging service offers referential integrity between the code that references them and the message channel.
    • It restricts the deletion of message channels, which are referenced by other codes. Further, Lightning Message Service supports auto-adding message channels to packages.
    • As the metadata type is packageable, you can associate a message channel to a particular namespace and make it available/unavailable to other namespaces.
  • Introduction to Surveys in Salesforce : Every business small or big wants to satisfy its customers’ needs since customers are the lifeblood of any business. If you do not know what customers think about your service, you will never be able to give them the best customer experience. so any contact with a customer is […]

    Read More

  • The spring’21 release is available under the pre-release program  In this release, you will find new enhancements related to: Lightning Experience Salesforce Flow Lightning Web Component Apex Experience Cloud Pardot Quip Tableau CRM And APIs Sales Features : Flexibility to track information on opportunity products and more options for lead conversion. Package providers get more […]

    Read More

  • 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

  • Restriction Rules in Salesforce

    Restriction rules let you enhance your security by allowing certain users to access only specified records. They prevent users from accessing records that can contain sensitive data or information that isn’t essential to their work. Restriction rules filter the records that a user has access to so that they can access only the records that match the criteria you specify.

    You can create up to two active restriction rules per object in Enterprise and Developer editions and up to five active restriction rules per object in Performance and Unlimited editions. Restriction rules are applied to the following Salesforce features:

    • List Views
    • Lookups
    • Related Lists
    • Reports
    • Search
    • SOQL 
    • SOSL


    When a restriction rule is applied to a user, the records that the user is granted access to via org-wide defaults, sharing rules, and other sharing mechanisms are filtered by criteria that you specify. For example, if users navigate to the Today’s Tasks tab or to a list view for activities, they see only the records that meet the restriction rule’s criteria. If a user has a link to a record that is no longer accessible after a restriction rule is applied, the user sees an error message.

    Configure Salesforce Restriction Rules

    Let see how to create Salesforce Restriction rules . Please follow below step to do that

    1.Click on Setup

    2..Then Click on Object Manager

    3.From Object Manager Select the Task Object ( You can select which on which you want to create restriction rules)

    4.Then Click on New Rule button

    5.Then configure the Salesforce restriction rule as per client requirement.

    Where can Restriction Rules be available and applied?Enhance your org’s security with restriction rules.

    As of now, Restriction Rules are available for:

    1. Custom Objects
    2. Contracts
    3. External Objects
    4. Events
    5. Time Sheets
    6. Tasks
    7. Time Sheet Entries.

    Enhance your org’s security with restriction rules

    Enhance your org’s security with restriction rules

    If you have users that should only have access to a specific subset of records, restriction rules provide another level of security that you can layer on top of your existing organization-wide defaults, sharing rules, and other settings.

    Here are three examples of how using restriction rules can provide an additional layer of security in your org:

  • B2B SaaS company setting up sales & marketing process

    If you are a B2B SaaS company setting up a sales & marketing process, how potential buyers flow through your CRM system is important stuff.  If you want to scale your business and become a predictable sales and marketing machine, here are the reasons why you want to put a little thought into your setup:

    • Gain a better understanding of Funnel Attrition and Funnel Velocity so that you can see how quickly deals move through the funnel, and how many “leads” it takes to win a new customer.
    • Figure out where “leads” are coming from. Get a handle on Lead Source attribution so that you can double down on the lead sources that work and stop spending on the ones that don’t.
    • Understand where a buyer is in their journey with you so that you can respond appropriately and with the correct urgency.
    • Hold your sales and marketing team to task on leading indicators. The leading indicators should become predictors of future success.

    What’s the best way to structure your process?

    Wondering the best way to structure your marketing & sales process?  Even for B2B SaaS companies (which is a market that Twopir specifically focuses on), the answer is not always straightforward.  Ask yourself these questions:

    • What percentage of your top-of-funnel leads (TOFU) are coming from Paid or Organic web traffic versus outbound or referral-type activities?
    • How definable is your target universe? Can you identify 80%+ of the target buyers in your market?
    • At what point does your team engage with early prospects?
    • How long is your sales cycle?
    • Do you sell one or multiple products to one or multiple buyer personas within one customer account?

    This information will help decide if you should use one of these three approaches.

    • Leads: If you have a strong inbound marketing process, shorten the sales cycle, are product-led, and a wide open target audience.
    • Contacts: Best way to go is if you sell many solutions to many buyers in one organization, and all are sales led GTM strategies.
    • Accounts: Perfect for sales led organizations that have complex sales cycles and multiple decision makers.

    Till the approach you take, think about including these principles into your sales & marketing flow.

    Sirius Decision’s Demand Unit Waterfall

    We are big fans of the updated Sirius Decisions approach. You’ll be familiar with the old acronyms like MQL, and SQL.
    Thank Sirius for those. Well, they updated the approach in 2017 with more human language and a much simpler
    process. I mean who wants to be called an MQL? And trying to create those workflows ina CRM system was crazy. I like
    the new approach because it allows for more fluidity in a non-linear sales process. This is often common in Enterprise
    B2B SaaS where prospects go in and out of buying patterns over long periods.

    Types of Relationship

    With the Account or Contact stages, differentiating contacts and accounts is equally important. We differentiate
    prospects from customers of other relationships. And we get a little more granular because we differentiate certain
    situations. For example, we recommend classifying active customers differently from lost customers; and prospects
    from re-prospects. Workflows automatically update the relationship type based on the event. For example, a prospect
    that has its first opportunity Closed Won updates to an Active Customer. An Active Customer that doesn’t renew becomes a Lost Customer. A Prospect that loses their first opportunity becomes a Re-Prospect.

    Lead Scoring

    If we use a marketing automation system, consider combining Lead Scores (and potentially grades) into the Sirius Decisions Demand waterfall. Specifically to move a ‘lead’ record from Active to Engage, or Engaged to Prioritized. Lead Scoring is behavior-based, which means the score is determined by actions taken by a potential buyer. The Grade is applied using potential information. For example location, industry, or title information to score a lead. Some systems use grading like Grade-A through Grade-E, and others use a numeric point system. Generally, we’d recommend not to include lead grading because the data is not always perfect, and often requires more profiling than is reasonable.  Here’s a sample behavior-based Lead Scoring system:

    • The threshold for Prioritized = 100
    • Inquiry Form Fill = 50 points
    • Page Visit = 10 points
    • Event Registration = 20 points
    • Download = 20 points

    ‘Lead’ that has > 0 points will get ‘engage’. You can role-up the points from contacts associated with an account. Else, you might miss some action.  Identify at what point you want your sales or BDR team to engage prospects. Someone who downloads a document could probably be left alone for a while.  But if they download two documents and register for an event, that’s 60 points in this model.  It might be worth a courtesy call. We recommend engagement at 100 points with a human decision on whether or not to move them to Qualified or push them back down to Engaged.  If you want you can also consider negative points for certain actions like when the opportunity is lost set points to zero or resetting points after each year.

    Conversion Metrics

    Once you can capture this information you can track historic results, for example, the number of ‘leads’ that were
    Prioritized month over month. You can also track the ratio of ‘leads’ that are converted from Prioritized to Qualified.
    Ideally, you would track all the times a lead comes in and out of these stages, not just the last time.

    Over time, you’ll get a sense of how long your average buying cycle is from Engaged to Closed; and the number of
    Prioritized Leads it takes to get a new customer. By tracking lead sources and other enriched data points, you’ll be able
    to analyze this information by segment. Let’s talk about Deal Velocity in another post, but equally important is
    capturing the number of days that deals take at various stages. Let’s talk about Deal Velocity in another post, but
    equally important is capturing the number of days that deals take at various stages.

  • What is a Flow in Salesforce? Flow is an application inside the Salesforce that automates a business process by collecting data and performing operations in your org or an external system. Flow can fetch, delete, update and create records on multiple objects. Flow Builder is the declarative interface used to build individual flows. Flow Builder […]

    Read More

  • Efficient queries not only perform better, but they help ensure that you don’t run into problems with governor limits. And it can crash a system faster than anything is a poorly performing query. And that is where governor limits come in. Your SOQL query may return so many objects that the limit on heap size […]

    Read More

  • Salesforce introduced Marketing Cloud for Nonprofits to aid them in producing more personalized experiences for their clients in a very short span of time and productively, regardless of their digital transformation journey. Nonprofits had been gone through a tough 18 months, with being swamped with their new contributors and others struggling to raise funds through in-person […]

    Read More