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):


May 20, 2021

How to hide Pop Out when displaying Visualforce page in Utility Items (Desktop Only) in Salesforce

Visualforce Page:
<apex:page>
    Test VF Component
</apex:page>

Aura Component:
<aura:component implements="lightning:utilityItem">
    <aura:attribute name="supportsPopOut" type="Boolean" default="false" />
    <iframe src="/apex/Utility"></iframe>
</aura:component>

App Configuration:
 

Output:


Customer Portal Users and Partner Users in Change Owner in Salesforce

Before enabling Experience Cloud(Community Cloud):
 
 
After enabling Experience Cloud(Community Cloud):
 
 

May 19, 2021

Salesforce Chat License

Digital Engagement SKU is needed.
 
Using Digital Engagement, reach customers across every digital channel including mobile messaging, web chat, social networks, and more to provide a seamless service experience for service.
 
 
Available to Sales and Service cloud orgs(please check above link for more details).
 
In the above link, use "DOWNLOAD THE FULL EDITION COMPARISON CHART" and check the  "Digital Engagement SKU Includes" section.

Trailhead Resources:

May 17, 2021

Access Conversation Entries Salesforce Permission


To Access ConversationEntry entity, this permission is mandatory. 
To use the ConversationEntry object for Chat, enable the new Access Conversation Entries user permission.

 
This is applicable to Chat, Messaging and Service Cloud Voice entities.

May 14, 2021

"You cannot transfer a Partner Portal contact to a non Partner Portal account" Salesforce

Follow the below steps to change the Account.
 
Option 1:
1. Open the Contact record.
2. Use "Disable Partner User" to disable the Contact as Partner User.
3. Now change the Account.

Option 2:
1. Open the Account to which the Contact has to be mapped. Select "Enable as Partner".
2. Select Yes, I want to enable this account as a Partner Account. Click Confirm button.
3. Now change the Contact's Account.

How to add new line in RichText Area field using Apex in Salesforce?

Sample Code:
trigger AccountTrigger on Account ( before update ) {  
 
    for ( Account acc : trigger.new ) {  
      
        acc.Rich_Text_Area__c = 'Updated on <br/>' + System.now();  
              
    }  
      
}


May 13, 2021

How to increase Visualforce page height in Utility Items in Salesforce Lightning App?

Use Height (in pixels) to increase Visualforce page height in Utility Items in Salesforce.


May 10, 2021

Campaign in Salesforce

A Salesforce Campaign is a set of Campaign Members(Leads and Contacts).

How to add multiple Leads and Contacts to a Campaign in Lightning Experience in Salesforce? - https://www.infallibletechie.com/2018/04/how-to-add-multiple-leads-and-contacts.html

Campaign Influence in Salesforce - https://www.infallibletechie.com/2015/11/campaign-influence-in-salesforce.html

Salesforce Help Article - https://help.salesforce.com/articleView?id=sf.campaigns_def.htm&type=5 

Trailhead - https://trailhead.salesforce.com/en/content/learn/modules/campaign_basics

Salesforce Survey implementation with Experience Cloud(Community Cloud) and Embedded Chat

1. Make sure Service Cloud and Chat User check boxes are enabled for you.
 

2. Enable Omni-Channel Settings.
 

3. Enable Chat Settings.
 

4.  Create a Routing Configuration.


5. Create a Queue with Routing Configuration from step 4. Select Chat Transcript in Supported Objects and select queue members to receive chats.


6. Create a Chat button with Routing Type as "Omni-Channel" and Queue with the Queue created in Step 5. 


7. Create a Chat Deployment.


8.Create a Permission Set. Set Salesforce as the License. Make sure "Salesforce Surveys Advanced Features" permission under System Permission is enabled. Assign the permission set to you.


9. Go to Surveys Tab and create a simple Survey.
 
 



 
10. Go to Settings under Digital Experience. Enable it.


11. Create a Community. I have used "Customer Service" template. Don't forget to activate the community.


12. Go to Embedded Service deployments in Setup and create a Embedded Service deployment. Select the Community created in Step 11.


13. In Chat Settings, click Start button. Select the Survey created in Step 9.


14. Open the Experience Site Builder. Select the Home page. Make it Public.


15. Configure Chat in the Home page.


16. Now navigate to Settings and select Security & Privacy. Set Security Level to "Relaxed CSP: Permit Access to Inline Scripts and Allowed Hosts". Click Allow from the blocked section for Chat related scripts to run.


17. Now navigate to General Tab. Select "Public can access the site". Click Survey Profile. Give Read access to Survey and Survey Invitation objects. Give Read and Create access to Survey Response object.


18. Click Publish to publish the community.

19. Create Presence Status for Chat if not created.
 
20. Assign Omni-Channel utility to Salesforce Console app if not done.
 
21. Use the Community url in Incognito window and initiate the chat. Make sure an agent is available to accept the chat.

22. End the chat. Click Give Feedback.