June 16, 2021

Salesforce Pre Chat for Embedded Service using Lightning Aura Component

Sample Code:

Aura Component:

<aura:component implements="lightningsnapin:prechatUI">
    <lightningsnapin:prechatAPI aura:id="prechatAPI"/>
    <aura:handler name="init" value="{!this}" action="{!c.onInit}" />
    <aura:attribute name="startBool" type="Boolean" default="false"/>
    <aura:attribute name="errorBool" type="Boolean" default="false"/>
    <aura:attribute name="firstName" type="Boolean" default="false"/>
    <aura:attribute name="lastName" type="Boolean" default="false"/>
    <aura:attribute name="email" type="Boolean" default="false"/>
    <aura:attribute name="subject" type="Boolean" default="false"/>
    <aura:attribute name="prechatFieldComponents" type="List" description="An array of objects representing the pre-chat fields specified in pre-chat setup."/>
    <h2>Prechat form</h2>
    <div>
        Claims FAQs - <a href="www.infallibletechie.com">Click Here</a><br/>
        Payment FAQs - <a href="www.infallibletechie.com">Click Here</a><br/><br/><br/>
        <ui:button label="Want to Chat with our Agent?" press="{!c.onHelpButtonClick}"></ui:button><br/><br/><br/>
        <aura:if isTrue="{!v.startBool}">
            <div>
                <table cellspacing="10" cellpadding="10" width="100%">
                    <aura:iteration items="{!v.prechatFieldComponents}" var="field">                        
                        <tr>{!field}<br/></tr>   
                    </aura:iteration>
                </table>
                <br/>
                <aura:if isTrue="{!v.errorBool}">
                    <div class="errorMessage">
                        Please fill in all the required fields
                    </div>
                </aura:if>
                <ui:button aura:id="startButton" label="Start Chat" press="{!c.handleStartButtonClick}"/>
            </div>
        </aura:if>
    </div>
</aura:component>

JavaScript:
({
    
    onInit : function( component, event, helper ) {
        
        var prechatFields = component.find( "prechatAPI" ).getPrechatFields();
        var prechatFieldComponentsArray = helper.getPrechatFieldAttributesArray( prechatFields );
        $A.createComponents(
            prechatFieldComponentsArray,
            function( components, status, errorMessage ) {
                if ( status === "SUCCESS" ) {
                    
                    component.set( "v.prechatFieldComponents", components );
                    
                }
            }
        );
        
    },
    
    handleStartButtonClick: function( component, event, helper ) {
        
        helper.onStartButtonClick( component );
        
    },
    
    onHelpButtonClick:function( component ) {
        
        component.set( "v.startBool", "true" );
        
    }
    
})

Helper:
({
    
    fieldLabelToName: {
        "First Name": "FirstName",
        "Last Name": "LastName",
        "Email": "Email",
        "Subject": "Subject"
    },
    
    getPrechatFieldAttributesArray: function( prechatFields ) {
        
        var prechatFieldsInfoArray = [];
 
        prechatFields.forEach( function( field ) {
            
            var componentName = ( field.type === "inputSplitName" ) ? "inputText" : field.type;
            var componentInfoArray = [ "ui:" + componentName ];
            var attributes = {
                "aura:id": "prechatField",
                required: field.required,
                label: field.label,
                disabled: field.readOnly,
                maxlength: field.maxLength,
                class: field.className,
                value: field.value
            };
            
            if ( field.type === "inputSelect" && field.picklistOptions )
                attributes.options = field.picklistOptions;
            
            componentInfoArray.push( attributes );
            prechatFieldsInfoArray.push( componentInfoArray );
            
        });
 
        return prechatFieldsInfoArray;
    },
    
    onStartButtonClick: function( component ) {
        
        var prechatFieldComponents = component.find( "prechatField" );
        var fields;
        fields = this.createFieldsArray( prechatFieldComponents );
        
        if ( component.find( "prechatAPI").validateFields( fields ).valid ) {
            
            if ( fields[ 0 ].value && fields[ 1 ].value && fields[ 2 ].value && fields[ 3 ].value ) {
            
                component.find( "prechatAPI").startChat( fields );
                
            } else {
                
                component.set( "v.errorBool", "true" );
                
            }
            
        } else {
            
            console.warn( "Prechat fields did not pass validation!" );
            
        }
        
    },
 
    createFieldsArray: function( fields ) {
        
        if( fields.length ) {
            
            return fields.map( function( fieldCmp ) {
                return {
                    label: fieldCmp.get( "v.label" ),
                    value: fieldCmp.get( "v.value" ),
                    name: this.fieldLabelToName[ fieldCmp.get( "v.label" ) ]
                };
            }.bind( this ) );
            
        } else {
            
            return [];
            
        }
        
    }
    
})

CSS:
.THIS .uiLabel {
    font-weight: bold;
}

.THIS .errorMessage {
    color: red;
    font-weight: bold;
}


Output:


June 14, 2021

Knowledge Field History Tracking in Salesforce

 1. Enable "Track Field History".


2. Use Set History Tracking.


Find users part of Permission Set License in Salesforce

Syntax:
SELECT Id, UserName FROM User WHERE Id IN ( SELECT AssigneeId FROM PermissionSetLicenseAssign WHERE PermissionSetLicense.MasterLabel = '<Name of the Permission Set License' )
 
You can get the Name of the Permission Set License from Company Information.
 
Sample:
SELECT Id, UserName FROM User WHERE Id IN ( SELECT AssigneeId FROM PermissionSetLicenseAssign WHERE PermissionSetLicense.MasterLabel = 'Messaging User' ) 
 
 The above query returns all the users who have Messaging User Permission Set License.

June 11, 2021

Block Visitor or Spam Block from Chat Salesforce

1. Create a Chat Agent Configuration.

2. Enable "Visitor Blocking Enabled".


3. Add Agents or their profiles to it.
 
4. Now agents can view Block icon.
 
 


Files attached to Messages in Salesforce Messaging

Files are stored in ContentDocument entity. 
 
Use this soql to find the ContentDocumentId. 
SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '<MessagingSessionId>'
 
Example:
1. Run the below SOQL.
SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '0Mw3h00000146TkCAI'
 
 0Mw3h00000146TkCAI is the Messaging Session Id.

2. Use the ContentDocumentId and open the file.


June 8, 2021

Drop Additional Skills Time-Out (seconds) in Salesforce Skill-Based Routing

Drop Additional Skills Time-Out (seconds) in Salesforce Skill-Based Routing

Set the time to elapse before additional skills are dropped from Omni-Channel routing.


For example, lets take two Skills SkillA and SkillB are used. Once all the agents with SkillA and SkillB skills are at maximum capacity, Omni-Channel will wait for 120 seconds until it drops the SkillA skill and just look for agents with SkillB skill then assign the record(Chat, Case, Messaging, etc.) to them.

June 4, 2021

How to assign the Chat to other available agents when the agent is not accepting the Chats in Salesforce?

Use Push Time-Out.
 
Push Time-Out is the amount of time given to an agent to respond to an assigned item (Chats or other records when using Omni-Channel) before it’s pushed to another agent. This can be set with Chat Routing Information and with Omni-Channel Routing Configurations. If both are configured with a different a value (time in seconds) the time set for Chat takes precedence over Omni-Channel routing configuration.

https://help.salesforce.com/articleView?id=000313054&mode=1&sfdcIFrameOrigin=null&type=1
 
Routing Configuration:
 

As per the above Routing Configuration, the chat will be routed to other available agent if the currently assigned doesn't accept the Chat in 10 seconds.

Dynamic Picklist using lightning combobox in Lightning Web Component in Salesforce

Sample Code:
 
HTML:
<template>
    <lightning-card>
        <div style="width:200px; padding:0.5rem;">
            <lightning-combobox
                name="filter"
                label="Industry"
                value={selectedValue}
                options={options}
                onchange={handlePicklistChange}
                placeholder="Select Industry">
            </lightning-combobox>
        </div>
    </lightning-card>
</template>

JavaScript:
import { LightningElement, wire } from 'lwc';
import INDUSTRY_FIELD from '@salesforce/schema/Account.Industry';
import { getPicklistValues, getObjectInfo } from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';

export default class SampleLWC extends LightningElement {

    options = [];
    picklistOptions = [];
    selectedValue;

    @wire( getObjectInfo, { objectApiName: ACCOUNT_OBJECT } )
    objectInfo;

    @wire( getPicklistValues, { recordTypeId: '$objectInfo.data.defaultRecordTypeId', fieldApiName: INDUSTRY_FIELD } )
    wiredData( { error, data } ) {

        console.log( 'Inside Get Picklist Values' );

        if ( data ) {
                            
            console.log( 'Data received from Picklist Field ' + JSON.stringify( data.values ) );
            this.options = data.values.map( objPL => {
                return {
                    label: `${objPL.label}`,
                    value: `${objPL.value}`
                };
            });
            console.log( 'Options are ' + JSON.stringify( this.options ) );

        } else if ( error ) {

            console.error( JSON.stringify( error ) );

        }

    }

    handlePicklistChange( event ) {
        
        console.log( 'New Value selected is ' + JSON.stringify( event.detail.value ) );   

    }

}

Output:
 
 

June 3, 2021

How to get Chat Transcript fiel value in Salesforce Embedded Chat?

1. Create a Custom Field in Chat Transcript object.
 
 
2. Create the same Custom Field in Contact object.
 
 
3. Add the Custom field from Contact to the Embedded Service Chat Deployment.
 
 

For you Website:
        embedded_svc.settings.extraPrechatFormDetails = [ {
            "label": "Skill",
            "transcriptFields":[ "Skill__c" ],
            "displayToAgent": true
        } ];

 
For Community or Experience Cloud:
1. Create a Static Resource(JavaScript File).
 
window._snapinsSnippetSettingsFile = ( function() {

    console.log( "Static Resource file loaded" );

    embedded_svc.snippetSettingsFile.extraPrechatFormDetails = [ {
        "label": "Skill",
        "transcriptFields":[ "Skill__c" ],
        "displayToAgent": true
    } ];
    
})();
 
2. Note the Static Resource Name.
 
3. Configure it in the Experience Builder. Use "Snippet Settings File".
 
 

Output:
 
 



June 1, 2021

How to route Chats to different Skills with one Routing Configuration in Salesforce?

1.  Enable Skills-Based Routing under Omni-Channel Settings.


2. Create a Custom Field in Chat Transcript object. I have created Skill__c(Picklist field) to route chats based on the Skill selection.


3. Create a Pre-Chat Visualforce page to capture Custom Field(Skill__c) from the Pre-Chat Form.
Sample Pre-Chat Visualforce Page Code:
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" title="Pre-Chat Form" cache="false">
    <!-- form id should be used in getElementById() -->
    <script type="text/javascript">
        (function() {
            function handlePageLoad() {
                var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
                document.getElementById('prechatForm').setAttribute('action',
                        decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
            }
            if (window.addEventListener) {
                window.addEventListener('load', handlePageLoad, false);
            } else {
                window.attachEvent('onload', handlePageLoad, false);
            }
        })();
    </script>

    <form method='post' id='prechatForm'>
        <table cellspacing="5" cellpadding="5">
            <tr>
                <td>First Name</td>
                <td><input type='text' name='liveagent.prechat:ContactFirstName' /></td>
            </tr>
            <tr>
                <td>Last Name</td>
                <td><input type='text' name='liveagent.prechat:ContactLastName' /></td>
            </tr>
            <tr>
                <td>Email</td>
                <td><input type='text' name='liveagent.prechat:ContactEmail' /></td>
            </tr>
            <tr>
                <td>Skill</td>
                <td>
                    <select name="liveagent.prechat:ChatSkill">
                        <option value="">--None--</option>
                        <option value="Sales">Sales</option>
                        <option value="Service">Service</option>
                    </select>

                </td>
            </tr>
            <tr>
                <td>Subject</td>
                <td><input type='text' name='liveagent.prechat:CaseSubject' /></td>
            </tr>
        </table>
        <!-- Contact creation Start -->
        <input type="hidden" name="liveagent.prechat.findorcreate.map:Contact" value="FirstName,ContactFirstName;LastName,ContactLastName;Email,ContactEmail" />
        <input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Contact" value="FirstName,true;LastName,true;Email,true" />
        <input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Contact" value="FirstName,true;LastName,true;Email,true" />
        <!-- Contact creation End -->
        <!-- Case creation Start -->
        <!-- Setting Case Status and Origin -->
        <input type="hidden" name="liveagent.prechat:CaseStatus" value="New" /><br />
        <input type="hidden" name="liveagent.prechat:CaseOrigin" value="Chat" /><br />
        <input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Subject,CaseSubject;Status,CaseStatus;Origin,CaseOrigin" />
        <input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Subject,true;Status,true;Origin,true" />
        <!-- Case creation End -->
        <!-- Linking Contact and Case to the Chat Transcript -->
        <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Contact" value="ContactId" />
        <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="CaseId" />
        <!-- Saving Skill value to the Chat Transcript -->
        <input type="hidden" name="liveagent.prechat.save:ChatSkill" value="Skill__c" />
        <!-- Showing the Contact and Case when the Chat loads automatically in a subtab in the Salesforce console -->
        <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Contact" value="true" />
        <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />
        <!-- Linking Case to the Contact -->
        <input type="hidden" name="liveagent.prechat.findorcreate.linkToEntity:Contact" value="Case,ContactId" />
        <input type="submit" value="Submit"/>
    </form>
</apex:page>       
 
4. Create Skills under Salesforce Setup.
 
5. Create a Routing Configuration. Make sure "Use with Skills-Based Routing Rules" is enabled.
 
6. Create a Queue for Skill Based Routing Configuration created in Step 5.

 
7. Create a Chat Button for Skill Based Routing.
 

8. Create a new Skills-Based Routing Rule for Chat Transcript object. Select the Skill(Custom Picklist Field) for routing.



Output:
        

 

How to save custom field value on Chat Transcript object(LiveChatTranscript) in Salesforce?

Sample Pre-Chat Visualforce Page Code:
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" title="Pre-Chat Form" cache="false">
    <!-- form id should be used in getElementById() -->
    <script type="text/javascript">
        (function() {
            function handlePageLoad() {
                var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
                document.getElementById('prechatForm').setAttribute('action',
                        decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
            }
            if (window.addEventListener) {
                window.addEventListener('load', handlePageLoad, false);
            } else {
                window.attachEvent('onload', handlePageLoad, false);
            }
        })();
    </script>

    <form method='post' id='prechatForm'>
        <table cellspacing="5" cellpadding="5">
            <tr>
                <td>First Name</td>
                <td><input type='text' name='liveagent.prechat:ContactFirstName' /></td>
            </tr>
            <tr>
                <td>Last Name</td>
                <td><input type='text' name='liveagent.prechat:ContactLastName' /></td>
            </tr>
            <tr>
                <td>Email</td>
                <td><input type='text' name='liveagent.prechat:ContactEmail' /></td>
            </tr>
            <tr>
                <td>Skill</td>
                <td>
                    <select name="liveagent.prechat:ChatSkill">
                        <option value="">--None--</option>
                        <option value="Sales">Sales</option>
                        <option value="Service">Service</option>
                    </select>

                </td>
            </tr>
            <tr>
                <td>Subject</td>
                <td><input type='text' name='liveagent.prechat:CaseSubject' /></td>
            </tr>
        </table>
        <!-- Contact creation Start -->
        <input type="hidden" name="liveagent.prechat.findorcreate.map:Contact" value="FirstName,ContactFirstName;LastName,ContactLastName;Email,ContactEmail" />
        <input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Contact" value="FirstName,true;LastName,true;Email,true" />
        <input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Contact" value="FirstName,true;LastName,true;Email,true" />
        <!-- Contact creation End -->
        <!-- Case creation Start -->
        <!-- Setting Case Status and Origin -->
        <input type="hidden" name="liveagent.prechat:CaseStatus" value="New" /><br />
        <input type="hidden" name="liveagent.prechat:CaseOrigin" value="Chat" /><br />
        <input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Subject,CaseSubject;Status,CaseStatus;Origin,CaseOrigin" />
        <input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Subject,true;Status,true;Origin,true" />
        <!-- Case creation End -->
        <!-- Linking Contact and Case to the Chat Transcript -->
        <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Contact" value="ContactId" />
        <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="CaseId" />

        <!-- Saving Skill value to the Chat Transcript -->
         <input type="hidden" name="liveagent.prechat.save:ChatSkill" value="Skill__c" />
        <!-- Showing the Contact and Case when the Chat loads automatically in a subtab in the Salesforce console -->
        <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Contact" value="true" />
        <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />
        <!-- Linking Case to the Contact -->
        <input type="hidden" name="liveagent.prechat.findorcreate.linkToEntity:Contact" value="Case,ContactId" />
        <input type="submit" value="Submit"/>
    </form>
</apex:page>
 
Output:
 

 

May 30, 2021

Salesforce Products are not visible in the Price Book

A price book is a list of products and their prices.
 
To make Products are visible for a Price Book
 
1. Add the Products to the Price Book and enter the Amount.
 
2. Active checkbox in Price Book decides whether you can add the price book to an opportunity or quote. So, Price Book record for the product should be Active.
 

 

Lightning Web Component to find whether impersonated as a user using "Log in to Experience as User" in Salesforce Experience Cloud?

 

 
Sample LWC Code:
Apex Class:
public with sharing class LoggedInUserCheckController {
    
    @AuraEnabled( cacheable = true )    
    public static Boolean loggedInAsUserCheck() {
    
        Boolean loggedInAsUserBool = false;        
        Map < String, String > currentSessionInfo = Auth.SessionManagement.getCurrentSession();
        
        if ( currentSessionInfo.get( 'LoginHistoryId' ) == null &&
           currentSessionInfo.get( 'LoginType' ) == 'Unknown' &&
           currentSessionInfo.get( 'LogoutUrl' ) == null ) {
               
           loggedInAsUserBool = true;
           
       }

       return loggedInAsUserBool;
        
    }

}


LWC:
HTML:

<template>
    <lightning-card>
        Loggged in as Community User? {loggedInAsUserBool}
    </lightning-card>
</template>

JavaScript:
import { LightningElement, wire } from 'lwc';
import loggedInAsUserCheck from '@salesforce/apex/LoggedInUserCheckController.loggedInAsUserCheck';

export default class LoggedInUserCheck extends LightningElement {

    loggedInAsUserBool;

    @wire( loggedInAsUserCheck )  
    wiredData( value ) {

        const { data, error } = value;

        if ( data || data === false ) {
                            
            console.log( 'Data received from Apex ' + JSON.stringify( data ) );
            this.loggedInAsUserBool = data;

        } else if ( error ) {

            console.error( JSON.stringify( error ) );

        }

    }

}

js-meta.xml:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <isExposed>true</isExposed><targets>
    <target>lightningCommunity__Page</target>
</targets>
</LightningComponentBundle>
 
Output:
 
Admin Not Logged in as any user(without impersonation):
 
 
Admin when Logged in as an Experience Cloud User(with impersonation):


May 29, 2021

An internal server error has occurred Salesforce Experience Cloud - Public Community

An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

 
Thank you again for your patience and assistance. And thanks for using salesforce.com!

Error ID: 76677022-51278 (637474174)
 
The above error occurs when IP ranges is set up for Guest User Profile and accessed outside the IP Range.
 

May 28, 2021

How to capture Leads from Forms in Pardot and check in Salesforce?

1. Make sure you have an active Lead Assignment Rule.

2. Create a Simple Campaign in Salesforce.


3. Check whether the Campaign in Synced.


4. Go to Content Tab. Select Layout Templates. Create a simple template.

5. Go to Content Tab. Select Forms.
 
6. Click +Add Form to create a new Form. Select "Assign prospect via Salesforce active assignment rule" under Complete Actions.
 
 
7. Use the link from the Form and submit a record. 
 
8. Go to Leads tab in Salesforce to verify whether the Leads are getting created.

May 27, 2021

Salesforce Developer Edition with Pardot

1. Open the below link for requesting Salesforce Developer Edition with Pardot.

2. Fill all details.

3. Follow the instructions provided in the email to set password and recovery.
 
4. Navigate to Pardot Setup Home under Setup.
 
 
5. Click Assign Admin.

6. Give Business Unit Name and Select you as Business Unit Admin. Click Save.

7. Check for emails. You will receive a confirmation for adding you as Pardot Admin.
 
8.  Again click Assign Admin. Make sure Business Unit Status is Enabled.

9. Open the below link for Package Installation.

10. Install the Package in the Org which you signed up. Kindly wait for the email confirmation for the successful package installation.

11. Open the Permission Set "CRM User". Assign yourself since you have added you as Pardot Admin in Step 6.

12. Set Field Level Security to the below field in both Contact and Lead Objects for B2BMA Integration User and System Administrator Profiles.
Field Label - Email Opt Out    
Field Name - HasOptedOutOfEmail

13. Enable "Enable Pardot in Your Salesforce Org" under Pardot Setup Home in Salesforce Setup.

14. From App Launcher, open Pardot (B2B Marketing Automation) app.

15. Click Pardot Setting tab. Click Connectors.

16. Resume the Sync for Salesforce.com.

Additional Information:

Dynamic Tab Set with record detail in Salesforce

Sample Code:
 
Apex Class:
public class SampleAuraController {
    
    @AuraEnabled
    public static List < Knowledge__kav > fetchArticles() {
            
        return [ SELECT Id, Title FROM Knowledge__kav LIMIT 5 ];
    
    }
}


Component:
<aura:component implements="force:appHostable" controller="SampleAuraController">
    <aura:handler name = "init" value = "{!this}" action = "{!c.onInit}"/>
    <aura:attribute type="Knowledge__kav[]" name="articleList"/>
    <lightning:card>
        <lightning:tabset>
            <aura:iteration items="{!v.articleList}" var="item">
                <lightning:tab label="{!item.Title}" id="{!item.Id}">
                    <lightning:recordForm
                        recordId="{!item.Id}"
                        objectApiName="Knowledge__kav"
                        layoutType="Full"
                        mode="view" />
                </lightning:tab>
            </aura:iteration>
        </lightning:tabset>
    </lightning:card>
</aura:component>

JavaScript:
({
    
    onInit : function( component, event, helper ) {    
        
        let action = component.get( "c.fetchArticles" );  
        action.setCallback(this, function(response) {  
            let state = response.getState();  
            if ( state === "SUCCESS" ) {  
               
                console.log( "Returned value is " + JSON.stringify( response.getReturnValue() ) );
                component.set( "v.articleList", response.getReturnValue() );
                
            }  else {
                
                let showToast = $A.get( "e.force:showToast" );
                showToast.setParams({
                    title : 'Error',
                    type : 'error',
                    mode : 'sticky',
                    message : 'Some error occured'
                });
                showToast.fire();
                
            }
        });  
        $A.enqueueAction( action );         
        
    }
    
})

Output:


New Lead Notification Salesforce

Lead Notification through Assignment Rule:
 
1. Create an Email Template.


2. In the Lead Assignment Rule criterion, select the Email Template.


3. In the Lead page layout, click Layout Properties and select "Lead Assignment Checkbox".


Output:
 

Help Article for using Workflow or Process Builder - https://help.salesforce.com/articleView?id=000314064&type=1&mode=1
 
Check the below article if you are using API to create records 

May 25, 2021

Salesforce Workforce Engagement

Workforce engagement enables the conditions necessary for workers to do their best, most efficient work. By intelligently forecasting workforce demand and capacity planning and equipping agents with in-moment on-demand training, organizations can advance and streamline their service goals while improving the experience of customers.

Trailhead Resources:
https://trailhead.salesforce.com/en/content/learn/modules/workforce-engagement-for-service-quick-look

Capabilities:
Intelligent forecasts
Omni-channel capacity plans
Shift scheduling
In-stream push training

May 23, 2021

How to find whether impersonated as a user using "Log in to Experience as User" in Salesforce?


Visualforce Page:
<apex:page controller="CommunityPageController">
    Logged in As User? {!loggedInAsUserBool}
</apex:page>

Apex Controller:
public class CommunityPageController {
    
    public Boolean loggedInAsUserBool { get; set; }
    
    public CommunityPageController() {
    
        loggedInAsUserBool = false;        
        Map < String, String > currentSessionInfo = Auth.SessionManagement.getCurrentSession();
        
        if ( currentSessionInfo.get( 'LoginHistoryId' ) == null &&
           currentSessionInfo.get( 'LoginType' ) == 'Unknown' &&
           currentSessionInfo.get( 'LogoutUrl' ) == null ) {
               
           loggedInAsUserBool = true;
           
       }
        
    }

}

Logged in As Experience User(without impersonation):


Admin Logged in As Experience User(with impersonation):