Blog Right Sidebar

  • 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=”http://soap.sforce.com/2006/04/metadata”>
       <masterLabel>LMS Demo</masterLabel>
       <isExposed>true</isExposed>
       <description>Winter 20 – LMS Demo.</description> 
    </LightningMessageChannel>

    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.

    <apex:page>
        <!– Begin Default Content REMOVE THIS –>
        <h1>Lightning Message Services – Demo – Winter 20</h1>
        <div>
            <p>Message To Send</p>
            <input type=”text” id=”vfMessage” />
            <button onclick=”publishMessage()”>Publish</button> 
            <br/> 
            <button onclick=”subscribeMC()”>Subscribe</button> 
            <button onclick=”unsubscribeMC()”>Unsubscribe</button> 
            <br/>
            <p>Messages Received:</p>
            <textarea id=”txtMessages” rows=”2″ style=” width:100%;” />
        </div>
        <script> 
            // 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
                };
                sforce.one.publish(lmsDemoChannel, payload);
            }
            function subscribeMC() {
                if (!subscriptionToMC) {
                    subscriptionToMC = sforce.one.subscribe(lmsDemoChannel, onMCPublished);
                }
            }
            function unsubscribeMC() {
                if (subscriptionToMC) {
                    sforce.one.unsubscribe(subscriptionToMC);
                    subscriptionToMC = null;
                }
            }
            function onMCPublished(message) {
                var textArea = document.querySelector(“#txtMessages”);
                textArea.innerHTML = message ? ‘Message: ‘ + message.messageBody + ‘ From: ‘ + message.source : ‘no message payload’;
            } 
        </script>
    </apex:page>
    • 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}”/>
                <br/>
                <br/>
                <p>Latest Received Message</p>
                <lightning:formattedText value=”{!v.receivedMessage}”/>
            </div>
        </lightning:card>
    </aura:component>

    • Controller of Aura Component

    ({
        handleClick: function(component, event, helper) {
            let myMessage = component.get(“v.myMessage”);
            const payload = {
                source: “Aura Component”,
                messageBody: myMessage
            };
            component.find(“lmsDemohannel”).publish(payload);
        },
        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.

    <template>
        <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>
                <br>
                <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>
            </div>
        </lightning-card>
    </template>
    • 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 = ”;
        channel;
        context = createMessageContext();
        constructor() {
            super();
        }
        handleSubscribe() {
            const parentPage = this;
            this.channel = 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() {
            unsubscribe(this.channel);
        }
        handleChange(event) { 
            this._msg = event.target.value;
        }
        handleClick() {  
            const payload = {
                source: “Lightnign Web Component”,
                messageBody: this._msg
            }; 
            publish(this.context, lmsDemoMC, payload);
        } 
        disconnectedCallback() {
            releaseMessageContext(this.context);
        }
    }

    • 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

  • How to use the Lookup field in Lightning DataTable?

    We all know that Salesforce standard Lightning DataTable is the best table that we can use to display the record and it also does support the in-line editing. There are some limitations of the Standard lightning datatable like we can not have a lookup field, Picklist field or event some file upload for every column. In this blog post, I will show you how you can create a custom data type to show lookup, picklist, or anything that you wanted to have.

    Step1 – Create a new Lightning Web Component

    In this step, we will create a lightning web component which will extend the LightningDatatable like below

    export default class ExtendedDataTable extends LightningDatatable { }

    Extending LightningDatatable will help us to create our own Lightning DataTable Data Type

    Step2 – Create a Custom DataType for Custom Lookup



    Now, as you have created the new component, in the js file of the same component create a custom datatype like below.
    In the above example, I have defined the data type for the picklist and custom lookup.

    Step3 – Create a new html file inside the Same Web Component



    Now, you need to create the .html file inside the same Web Component. here is the sample code which is using a search component which is actually used for custom Lookup
    You can get the complete code for the Search Component from here

    Step4 – Prepare the Custom Lookup Columns for DataTable

    Now, we need to create a new Lighting Web Component which will be using the component which we have created on the top.

    Once you have created the component, you need to prepare the columns for data table like below

    The above code contains the column for custom lookup using our new component & data type that we have created.

    Here is the code for Custom Picklist

    Here is the code for custom file upload

  • Single Sign On(SSO)

    Single sign-on (SSO) lets users access authorized network resources with one login. You validate usernames and passwords against your corporate user database or other client app rather than Salesforce managing separate passwords for each resource.

     There are 2 ways we can implement SSO in Force.com

    1) Delegated authentication

    Delegated authentication SSO integrates Salesforce with an authentication method that you choose. You can integrate authentication with your LDAP (Lightweight Directory Access Protocol) server or use a token instead of a password for authentication. You manage delegated authentication at the permission level, not at the org level, giving you more flexibility. With permissions, you can require some to use delegated authentication while others use their Salesforce-managed password.
    Delegated authentication offers the following benefits.

    Uses a stronger form of user authentication, such as integration with a secure identity provider

    Makes your login page private and accessible only behind a corporate firewall

    Differentiates your org from all other companies that use Salesforce to reduce phishing attacks

    2) Federated Authentication

    Federated authentication using Security Assertion Markup Language (SAML) lets you send authentication and authorization data between affiliated but unrelated web services. You can log in to Salesforce from a client app. Salesforce enables federated authentication for your org automatically.

    Configure SSO Across Multiple Salesforce Orgs

    Let your users log in across multiple Salesforce orgs using single sign-on (SSO) credentials. With SSO, you can validate user credentials against a corporate database or other app rather than managing separate passwords for each Salesforce org.

    Enterprises often deploy more than one Salesforce org. Unless you implement SSO, users that access different orgs must reauthenticate with each org. Removing this extra login step makes it more convenient for users and enhances security because it’s easier for users to maintain and use a single, strong password.

    SSO follows a hub-and-spoke architecture. At the center is a centralized authentication hub, the identity provider. The identity provider validates credentials and asserts the user’s identity to the spokes—Salesforce orgs that are the service providers. The org that is the identity provider generates SAML assertions that follow the SAML 2.0 standard for SSO.

    Benefits of SSO

    Implementing SSO brings several advantages to your org.

    • Reduced administrative costs—With SSO, users memorize a single password to access network resources and external apps and Salesforce. When accessing Salesforce from inside the corporate network, users log in seamlessly and aren’t prompted for a username or password. When accessing Salesforce from outside the corporate network, the users’ corporate network login works to log them in. With fewer passwords to manage, system admins receive fewer requests to reset forgotten passwords.
    • Leverage existing investment—Many companies use a central LDAP database to manage user identities. You can delegate Salesforce authentication to this system. Then when users are removed from the LDAP system, they can no longer access Salesforce. Users who leave the company automatically lose access to company data after their departure.
    • Time savings—On average, users take 5–20 seconds to log in to an online app. It can take longer if they mistype their username or password and are prompted to reenter them. With SSO in place, manually logging in to Salesforce is avoided. These saved seconds reduce frustration and add up to increased productivity.
    • Increased user adoption—Due to the convenience of not having to log in, users are more likely to use Salesforce regularly. For example, users can send email messages that contain links to information in Salesforce, such as records and reports. When the recipient of the email message clicks the links, the corresponding Salesforce page opens.
    • Increased security—All password policies that you’ve established for your corporate network are in effect for Salesforce. Sending an authentication credential that’s only valid for a single time also increases security for users who have access to sensitive data.

    Viewing Single Sign-On Login Errors

    If your organization is enabled for Single Sign-On using delegated authentication and has built a Single Sign-On solution, you can view the most recent Single Sign-On login errors for your organization.


    • 1.From Setup, enter Delegated Authentication Error History in the Quick Find box, then select Delegated Authentication Error History.
    • 2.For the twenty-one most recent login errors, you can view the user’s username, login time, and the error.

  • Platform Event

    Introduction to Platform Events in Salesforce :

    • Consider this, a platform event is just like another custom object but this would only be referred by external systems to communicate with Salesforce. 
    • To put this in a scenario when a certain system posts data on a Salesforce endpoint then that data should be fetched and the data in Salesforce should be updated. 
    • Of course, you can use too many lines of code to continuously fetch and retrieve the data from the endpoint or just wait for data to be posted based on which an event shall be triggered and the next processes shall follow. 
    • Now, this is where platform events come into the picture, instead of writing lines and lines of codes and continuously requesting and checking if the data is posted we can just have a platform event trigger notify us and then have your logic do the rest of the heavy lifting.

    What are Platform Events in Salesforce?

    • Platform Event is based on Event-Driven Architecture which enables apps to communicate inside and outside of Salesforce. 
    • Platform events are based on the publish/subscribe model and work directly with a message bus which handles the queue of incoming events and processes listening for them. 
    • This is built in real time integration patterns in the Salesforce Platform which helps to reduce point-to-point integration.

    Here Are The Following Points We Should Remember :

    • Event: An adjustment in the expression that is important in a business procedure. 
    • Event Message/Notification: A message that contains information about the Event. 
    • Event Maker: The distributer of an occasion message over a channel. 
    • Channel: A conductor where an occasion maker sends a message. Event shoppers buy into the channel to get messages. Likewise alluded to as Event transport in Salesforce. 
    • Event Consumer: A supporter of a channel that gets messages from the channel.

    Publishing and subscribing Platform events :

    • Publishing and subscribing to the platform event are more flexible. 
    • You can publish event messages from a Force.com app or an external app using Apex or Salesforce APIs and you can subscribe from the Salesforce or external apps or use long polling with cometD as well.

    Define Platform Event :

    Define platform events similar like a custom object, go to setup –> develope –> Platform events –> create new platform events as shown below.

    Publish Platform events

    Publish Using Apex :

    • A trigger processes platform event notification sequentially in the order they’re received and trigger runs in its own process asynchronously and isn’t part of the transaction that published the event. 
    • Salesforce has a special class to publish the platform events EventBus which is having methods publish method. once the event is published you can consume the events from the channel.

    trigger PlatformEventPublish on Account (after insert , after update ) {

        If(trigger.isAfter && trigger.isUpdate){

            List<Employee_On_boarding__e> publishEvents = new List<Employee_On_boarding__e>();

            for(Account a : Trigger.new){

                Employee_On_boarding__e eve = new Employee_On_boarding__e();

                eve.Name__c = a.Name ;

                eve.Phone__c = a.Phone ;

                eve.Salary__c = a.AnnualRevenue ;

                publishEvents.add(eve);            

            }

            if(publishEvents.size()>0){

                EventBus.publish(publishEvents);

            }

        }

    }

    Publish Using Process Builder :

    Publish Events by Flow :

    • Run/Debug Flow:1(platform Event producer) and you will send post in chatter.

    Result:

    Subscribe for Platform events :

    • We can subscribe to the platform events from the Platform events object trigger which is created. 
    • Here is the sample trigger show how you can handle the subscribed events. create new accounts from the platform event but you can implement your own business logic to update the data.

    trigger OnBoardingTrigger on Employee_On_boarding__e (after insert) {

        List<Account> acc = new List<Account>();

        for(Employee_On_boarding__e oBording :trigger.new){

            acc.add(new Account(Name =oBording.Name__c , Phone =oBording.Phone__c , AnnualRevenue = oBording.Salary__c));

        }

        if(acc.size() >0){

            insert acc ;

        }

    }

    • you can consume the platform events by using this  URI /event/Employee_On_boarding__e and the Complete code is here below

    <apex:page standardStylesheets=”false” showHeader=”false” sidebar=”false”>

        <div id=”content”> 

        </div>

        <apex:includeScript value=”{!$Resource.cometd}”/>

        <apex:includeScript value=”{!$Resource.jquery}”/>

        <apex:includeScript value=”{!$Resource.json2}”/>

        <apex:includeScript value=”{!$Resource.jquery_cometd}”/>

        <script type=”text/javascript”>

        (function($){

            $(document).ready(function() {

                $.cometd.configure({

                    url: window.location.protocol+’//’+window.location.hostname+ (null != window.location.port ? (‘:’+window.location.port) : ”) +’/cometd/40.0/’,

                    requestHeaders: { Authorization: ‘OAuth {!$Api.Session_ID}’}

                });

                $.cometd.handshake();

                $.cometd.addListener(‘/meta/handshake’, function(message) {

                    $.cometd.subscribe(‘/event/Employee_On_boarding__e’, function(message) {

                        var div = document.getElementById(‘content’);

                                        div.innerHTML = div.innerHTML + ‘<p>Notification </p><br/>’ +

                            ‘Streaming Message ‘ + JSON.stringify(message) + ‘</p><br>’;

                    });

                })

            });

        })(jQuery)

        </script>

    </apex:page>

        

    Advantages of Salesforce Platform Events :

    • Clients can run organizations quicker on an event-driven architecture.
    • Make an entire 360-degree client experience – continuous reconciliation with any business cycle.
    • Event-driven work processes to enlarge information.
    • Can catch and follow up on a great many streaming events.
  • Lightning Reports & Dashboards Limitations And Allocations

    What Is A Report?

    A report is a list of records(like accounts or contacts) which must meet the criteria you defined in that. Various things you can do on report is filter, Group and math on records. There are benefits of using Report because it is stored in a folder. Report folders determine who can access the report because they can be shared in public, hidden or shared. You have the power to give access to organizations or it can be private at individual levels.

    Limitations of Report :

    • In Salesforce Classic, you can have a maximum 250 groups or 4,000 values in a chart. If an error message comes saying that your chart has too many groups or values to plot,then to reduce the number you have to adjust the report filters.
    • In Lightning Experience, a report chart can have at most 2000 groups. If a report has more than 2000 groups, the action ‘Combine Small Groups into Others’ applies only to the small groups within the 2000 that are included in the report chart. Any additional small groups are ignored.
    • Reports display a maximum of 2,000 rows. Export the report to Excel or use the printable view for tabular and summary reports to view more rows . For joined reports, the printable view displays a maximum of 20,000 rows. Printable view is only available in Salesforce Classic.
      • Summary reports (grouped by rows) and matrix reports (grouped by columns) display the first 2,000 groupings when Show Details is disabled.
      • Matrix reports display a maximum of 400,000 summarized values.
      • Matrix reports that return more than 2,000 rows don’t show details. If you click Show Details, nothing happens. You can only view the report with details hidden.
      • Because a matrix report includes multiple groupings, the maximum of 2000 values is typically reported in fewer than 2000 groups.
      • Matrix reports display a maximum of 2,000 groupings in the vertical axis when Show Details is disabled. If there are more than 400,000 summarized values, rows are removed until the 2,000 groupings limit is met. Then columns are removed until the number of summarized values moves below 400,000.
    • The report builder preview shows a maximum of 20 rows for summary reports (grouped by rows) and matrix reports (grouped by columns), and 50 rows for tabular reports (no groupings).
    • Up to five metrics display in the Lightning Experience report header. Metrics such as summarized fields appear in the order that they appear in the report, left to right. The grand total, when shown, always displays.
    • When viewed in the Salesforce mobile app, reports that have groupings are converted to tabular reports.
    • A maximum of 25 report columns is supported by the Salesforce mobile app.
    • By default, reports timeout after 10 minutes.
    • Each block can have up to 100 columns in a joined report.A joined report can have up to 5 blocks.
    • You can add up to 10 custom summary formulas to each block in a joined report. A joined report can have a total of 50 custom summary formulas.
    • When you add a block to a joined report and the block has multiple entities in common with the report, only the first entity (in alphabetical order) is shown. Only the fields from the first entity are shown in the common fields area.
    • Each joined report can have up to 10 cross-block custom summary formulas.
    • In a non-joined report, if you click a bar in a report chart, the report results are filtered according to the selected bar. In a joined report, clicking a bar doesn’t apply the filter.
    • If you filter on standard long text area fields, such as Description or Solution Details, only the first 1000 characters of the field are searched for matches in reports.
    • Some filters (such as date range) are constructed using multiple custom filters, each of which counts towards the total of 20.
    • Field-to-field filtering isn’t available on currency fields for orgs that have multi-currency enabled.
    • The first 999 characters in a standard rich text area or a long text area are displayed in a report. For custom fields, only the first 255 characters are displayed.
    • Up to 21-digits can be displayed by summary fields on tabular, summary, and matrix reports.
    • Reports can’t be filtered on custom long text area fields.
    • Joined reports require that the new user interface theme is enabled. Users without the new theme are unable to create, edit, or run joined reports.
    • In Lightning Experience, embedded report charts display the source report table’s groupings, not the report chart’s. In Salesforce Classic, embedded report charts display the source report chart’s grouping, not the report table’s groupings.
    • Forecast reports include only opportunities that are set to close within the forecast period, except those assigned to the Omitted forecast category.
    • Joined Reports does not support Internet Explorer 6.
    • Acceptable range for values: The maximum value allowed is 999999999999999. The minimum value allowed is -99999999999999.
    • Up to 500 individual recipients can be added.
    • Users sometimes don’t receive the updated report if a role or group contains more than 500 users.
    • Maximum of 5 reports can be subscribed by each person in org.
     

    What Is A Dashboard?

     

    A dashboard is a displaying records in virtual form. There is a relation between a dashboard component and report in the form of ration i.e.1:1. It means for each dashboard component there has to be a single report. Similar to reports, we have dashboards stored in folders, which determines who can access the dashboard. There are Dynamic dashboards which are useful for users who are always logged in.

    Limitations of Dashboard:

    • A dashboard table or chart can display a maximum of 20 photos.
    • A dashboard filter can have up to 50 values.
    • Each dashboard can have up to 20 components.
    • You cannot apply filter on bucket fields. However, you can use a report filtered on a bucket field on the dashboard page.
    • You have to wait at least one minute between dashboard refreshes.
    • Up to 500 individual recipients can be added. A recipient is a user, role, or group.
    • If a role or group contains more than 500 users, some users don’t receive the updated dashboard.
    • Filtering is restricted in some dashboards that contain multiple components based on different report types:
      • You can’t filter the dashboard on the Case Owner or Lead Owner field if a dashboard has a component based on Cases or Leads and another component based on a different report type. In addition, filtering on other Owner fields doesn’t display Case Owner or Lead Owner as equivalent fields.
      • If a dashboard has a component based on the Tasks and Events, Activities with Accounts, or Activities with Contacts report type and another component based on a different report type, you can’t filter the dashboard on the Assigned field.
    • Downloaded and shared images of dashboard component tables have a maximum height of 3000 pixels or approximately 100 rows. Extra rows beyond the limit are clipped. To avoid clipping, filter the chart to fewer than 100 rows.
    • The total value isn’t included in subscription emails for funnel charts.
    • File attachments for report subscriptions are limited to 15,000 rows, 30 columns, and 3 MB file size. Extra data is clipped or not sent.
    • Maximum of 5 dashboards can be subscribed by each person in your org.
  • Convert DateTime of one timezone to datetime of another Timezone

    Time zones in Salesforce:-

    Time zones come in two varieties — region-based and offset-based. In Salesforce, we see region-based time zones very often. 

    If you go to your Company Information page on setup, you would see a list of time zones. For example America/Chicago and America/Los_Angeles. The list of region-based time zones available in Apex is given in an article. Here is the complete list of supported timezones in salesforce. Apex supports all time zones returned by the TimeZone.getAvailableIDs method of the TimeZone class.

     

    TimeZone Class:-

    Represents a time zone. Contains methods for creating a new time zone and obtaining time zone properties, such as the time zone ID, offset, and display name

    You can use the methods in this class to get properties of a time zone, such as the properties of the time zone returned by UserInfo.getTimeZone, or the time zone returned by getTimeZone of this class.

     

    Example :-

    TimeZone tz = UserInfo.getTimeZone();
    System.debug('Display name: ' + tz.getDisplayName());
    System.debug('ID: ' + tz.getID());
    // During daylight saving time for the America/Los_Angeles time zone
    System.debug('Offset: ' + tz.getOffset(DateTime.newInstance(2012,10,23,12,0,0)));
    // Not during daylight saving time for the America/Los_Angeles time zone
    System.debug('Offset: ' + tz.getOffset(DateTime.newInstance(2012,11,23,12,0,0)));
    System.debug('String format: ' + tz.toString());
     

    Datetime class:-

    Datetime means a value that indicates a particular day and time, such as a timestamp. You can add or subtract an Integer or Double value from a Datetime value, returning a Date value. Addition and subtraction of Integer and Double values are the only arithmetic functions that work with Datetime values. You can’t perform arithmetic functions that include two or more Datetime values. Instead, use the Datetime methods.

     

    For example :-

    datetime myDateTime = datetime.now();</p>
    DateTime dt = DateTime.newInstance(2012, 1, 26, 5, 2, 4);
    System.assertEquals(2012, dt.year());
     

    So let’s use below code to convert time in different timezone

    public class ConvertTimeZoneService{
        
        public static string EST='America/New_York';
        ///Convert Any time to other timezone
        public Time convertDateTimeToOtherTimeZone(DateTime dttime, string sourceTimezone, string targetTimezone)
        {
            TimeZone tz = Timezone.getTimeZone(sourceTimezone);
            System.debug('Display name: ' + tz.getDisplayName());
            System.debug('ID: ' + tz.getID());
            
            Integer offset=tz.getOffset(dttime);
            System.debug('Offset: ' + offset);
            
            // target Timezone.
            TimeZone targetTZ = Timezone.getTimeZone(targetTimezone);
            System.debug('Display name: ' + targetTZ.getDisplayName());
            integer offsetTotargetTZ = targetTZ.getOffset(dttime);
           	integer correction = offsetTotargetTZ- offset;
        
            DateTime targetDT = dttime.addMinutes(correction / (1000 * 60));
            
            return Time.newInstance(targetDT.hour(), targetDT.minute(), targetDT.second(), targetDT.millisecond());
        }
    }
    
     

    1. Convert Datetime to another Timezone:-

    So to convert DateTime to another timezone we can use the above ConvertTimeZoneService class method.

    DateTime dtTime = DateTime.now();
    DateTime dtTimeTimeZone = new ConvertTimeZoneService().convertDateTimeToOtherTimeZone(dtTime, 'America/Santiago','America/New_York');
    
     

    So by using the convertDateTimeToOtherTimeZone method we can convert any DateTime to another timezone.

     

    2. Convert Time to another Timezone

    To convert Time to another TimeZone we can use the ConvertTimeZoneService class method by passing the DateTime value to that method which we want to convert.

    Date dt = Date.today();
    Time tm = acct.TimeToCall__c; //Here we can use any field which contains time
    DateTime dtTime = DateTime.newInstance(dt.year(),dt.month(),dt.day(),tm.hour(),tm.minute(),tm.second());
    DateTime dtTimeTimeZone = new ConvertTimeZoneService().convertDateTimeToOtherTimeZone(dtTime, 'America/Santiago','America/New_York');
    
  • Text Rich Area Field In Flow

    Rich Text fields provide important functionality but can be difficult to employ and deal with properly, especially in Flows. In this blog post, we will see how we can use a Lightning web component to act as a rich text area.

    What is a Rich Text Area Field? 

    • Rich Text is a field type that enables authors to create rich text content.
    • The Rich Text field provides rich formatting options for text entered into its field.
    • The text formatting options are presented in a toolbar which is displayed on top of the field.
    • Rich Text field type is mostly used when users need to apply various formatting options to their data, like changing the font, to enter html, to enter bulleted points and many other such options.
    • This field type accepts all kinds of data, for example, plain text, special characters, numbers.

    Limitations, when working with Rich Text Area Fields.

    • Salesforce supports up to 131,072 characters for each rich text area field, including the HTML tags.
    • An object can contain unlimited rich text area and long text area fields, although your edition’s allocation for total custom fields allowed on an object, regardless of field type, applies.
    • Each object can contain 1,638,400 characters across long text area and rich text area fields.
    • When you create a long text area or rich text area field, you set a character limit for the field—the maximum length of the text that can be entered.
    • You can’t paste special characters, such as bullets or curly quotes, into a rich text field from another application. It’s best to type or paste in plain text and use the rich text editor to format it.
    • HTML code isn’t supported in the Salesforce HTML editor. HTML code is treated as text.
    • The character count includes HTML markup that is not visible in the editor. The HTML markup is returned through the API.
    • Depending on how much formatting you apply, the number of characters you can type into the rich text field is fewer than the specified limit. This is because the HTML markup counts against the character limit of a field. For example, bold formatting includes the <b></b> tag around your text and adds up to 7 more characters.
    • Special characters like & are encoded as &amp; which adds up to 5 more characters. Also, the rich text field in Lightning Experience and Salesforce Classic can vary in HTML markup, such as with using RGB or hexadecimal values when color formatting is applied. Paragraph and line breaks also insert the <p></p> and <br> tags, counting against the character limit. See Editing Rich Text Area Fields in Records for information on formatting support.

    Steps To Add Text Rich Area Field In Flow?

    • Create a LWC component and name it TextAreaFlow.
    • You will get the complete code from Here.
    • To execute the flow action and for flow support we need to import some actions from the lightning/flowSupport library.

    import { FlowAttributeChangeEvent, FlowNavigationNextEvent, FlowNavigationFinishEvent, FlowNavigationBackEvent, FlowNavigationPauseEvent } from ‘lightning/flowSupport’;

    Configure Component in Flow

    • Create a flow or edit the flow where you wanted to use the rich text area field.
    • Drag & Drop the LWC inside the Screen element.

    Advantage of using Rich Text Area Field

    1. The Rich text field lets you add any kind of static text, image and others.
    2. There are multiple formatting options such as
    • Bold
    • Italics
    • Underline
    • Strikethrough
    • Text color
    • Alignment
    • Headings
    • Hyperlinks
    • Bullets
    • Blockquote
    • Add an image
  • Fault Path In Salesforce Flow

    Introduction to Salesforce Flow

    • Salesforce Flow empowers you to build complex business solutions using clicks, not code.
    • Flow Builder is the most powerful tool that a Salesforce Admin has at their disposal, giving you similar powers that Salesforce developers have.
    • If you need to perform mass updates across multiple unrelated records, or complex logic into opportunity conversion, these are common examples for when you should use Flow.
    • The use cases for Flow are endless, and its capabilities are growing with every Salesforce release.
    • Formerly Visual Flow, Salesforce Flow has gone through significant upgrades to give us the Flow Builder interface, after being completely rebuilt from the ground up.

    What are Salesforce Flows?

    • Flows allow you to build complex business automation using clicks instead of code. As an admin, Flows are going to be your best friend because you will be able to handle the majority of complex business requirements without the help of a Salesforce developer.
    • The benefit of Salesforce Flow is that they are easy to maintain because anyone (assuming they know Flows) should be able to follow along with what you built.
    • Flows are accessible through the Setup menu. Simply enter ‘Flows’ into the Quick Find box, and create a new Flow to get started

    What Happens When a Flow Fails?

    • When you’re deciding whether to customize the error handling in your flow, consider how a failed flow behaves.
    • When a flow fails, the user running the flow gets this error message.

    An unhandled fault has occurred in this flow
    An unhandled fault has occurred while processing
    the flow. Please contact your system administrator
    for more information.

    • The running user can’t proceed with the flow or return to a previous part of the flow. The admin who created the flow receives a faulty email.
    • The email details the element that failed, the error message from that element, and which elements were executed during the failed interview.
    • Here’s an example error message.

    An error occurred at element Delete_1.
    DELETE — There is nothing in Salesforce matching your
    delete criteria.

    The Fault Connector :

    • Most readers have seen the ‘Unhandled Fault’ message.
    • Wonder how many of you have seen ‘Fault Connectors’ which Salesforce provides to handle Flow errors.
    • They are recommended as best practice and using them can make flows failing a lot less stressful.
    • Can use the fault connector from any of the ‘data’ elements , or the Action elements in the Flow toolbox.

    How to Create a fault connector :

    • Simply create a second connection from your element after creating your first connection.
    • We now know how to create a fault connection, but what do we attach it to? Below is a simple screen flow which lets users create a Contact and Account at the same time.

    Where did the flow fail?

    • Use an assignment element to record exactly where the flow went wrong. Assign a value to a text variable called ‘Error location’.

    Advantage of adding Fault Path In Salesforce Flow :

    • Never see that red ‘Unhandled Fault’ message on your screen again.
    • Use a Screen element and Display Text to communicate with the user.
    • You can even add images and merge fields such as {!$Flow.FaultMessage}.
    • With this fault message, the user might even be able to see what is wrong themselves.

Post A Comment