Wednesday, October 4, 2017

Setup Service Cloud Lightning Snap-Ins with Omni Channel - Basic Steps




When it comes to CRM Customer Engagement, as per Gartner's Magic Quadrant for the CRM Customer Engagement Center, Salesforce is the in the "Leaders" section. Gartner estimates that 20% of Salesforce's new revenue came from Service Cloud in 2016 and it expects to exceed $2 billion in 2017. Reference: Gartner.

Service always tries to bring new features, innovations to market and the goal is always to increase customer satisfaction. In order to serve the customer better, Salesforce introduces a new feature called - Service Cloud Lightning Snap-In. Service Cloud Lightning Snap-ins are a fundamentally new way to deliver a service experience for today's connected customers. 

In this post, I will explain how to configure Lightning Snap-Ins with Omni Channel and receive chat request. So I know you guys are really excited to know this new feature. So without any further detail, let's get into the main topic. I am going to mention the steps below. If there is any pre-requisite, I will mention the same.

Step 1: Pre-Requisite: Live Agent and Omni Channel is enabled.
You need to make sure Live Agent and Omni Channel is enabled. There should be user present in your org with Live Agent checkbox checked. Omni Channel should be added to your console app.

Step 2: Create Queue for Live Chat Transcript

Step 3: Create Omni-Presence

Step 4: Create Live Chat Button

Step 5: Create Live Agent Deployment

Step 6: Create Force.com Site. 
You can refer Salesforce help link for creating Force.com Site. Link: https://help.salesforce.com/articleView?id=sites_overview.htm&type=5
Step 7: Enable Lightning in your org
Link: https://help.salesforce.com/articleView?id=lex_enable_turn_on.htm&type=5
Step 8: Add your website to CORS Whitelist
You should add the website domain to CORS Whitelist. This website is the one where you will include your snap-ins code. 
Link: https://help.salesforce.com/articleView?id=snapins_chat_cors_whitelist.htm&type=5
Step 9: Create Snap-Ins Deployment
In order to do this step, we need to move into Lightning Experience and then from setup, search for Snap-Ins. Click on "New Deployment". Give Deployment name and select the site you created @ step 6. Here is the screenshot -

Step 10: Configure Snap-ins Deployment
In this step, click on Start next to Live Agent Basic Settings. Select the Live Chat Button and Live Agent Deployment you created @ Step #4 & 5.

Step 11: Get the code and put it in HTML page

Step 12: Open the HTML page in your browser and you will see that Chat Button is available.

Step 13: Here is the animated video chat conversation from Lightning Snap-Ins

In my next post, I will explain the customization options available with Snap-Ins.

Reference:

Tuesday, September 26, 2017

Winter 18 - Automatically Styling of Existing Visualforce Pages in Lightning Experience

Salesforce Winter'18 release came with lots of surprises to all of us. Before Winter'18 release, one of the biggest pain to switch to Lightning was - How to migrate existing VisualForce pages? We all tried to use the standard VisualForce component in our VisualForce pages as a best practice till date. The reason was Salesforce's backward compatibility. We all knew that using standard VisualForce component is safe because even if Salesforce enhances those components, we don't need to change our VisualForce pages.
But with the introduction of Lightning, things changed. People all over the world started investing in changing their existing VisualForce pages into Lightning and it is a not a very straightforward task.

Salesforce realized the problem and in Winter'18 release came as a savior to all of us. With very minimum changes now, we can keep our existing VisualForce pages and it will still work in Lightning experience. This feature is still in beta mode as there are so many things to improve. But it is really a good starting point and good to know. I am quite sure Salesforce will support more and more components in coming releases. It is definitely a game changer.

In this post, I will explain with an example what you need to do in your existing VisualForce page to make it work in both Lightning and Classic.

I have written this below VisualForce page containing PageBlock, CommandButton, InputText, PageBlockTable.
VisualForce Page: AutomaticStylingPage


Apex Controller: AutomaticStylingPageController


Now when I am rendering the same page in Salesforce Classic and Lightning, below is how it looks like  -
Salesforce Classic:








Salesforce Lightning:










To make the same VisualForce page work in both Salesforce Classic and Salesforce Lightning, the only change we need to do in our existing VisualForce page is add lightningStylesheets="true"

It is very simple and really a big win for Lightning Migration activity.

Note -

  • This feature is in Beta as of Winter'18 release.
  • This will only work with apex tags. So if your VisualForce page is having custom styling, this is not going to work now. 


Monday, June 26, 2017

Salesforce Service Cloud - Contact Center Reports

As a call center manager, it is very important to monitor team's case performances targets, train new support agents, analyze team's open case performance and etc. There are multiple matrices which a call center manager normally monitor to improve contact center's performance.

Call center manager can use Salesforce reports to monitor critical support metrics such as -
  • Total open cases by agents
  • Total cases created by agents and status
  • Total cases created by agents and products
  • Total average age by agent
  • Total closed cases by agent
Let's start with few important reports here -

Agent Open Case Load by Origin/Type:
This report will help call center manager to determine his/her team's bandwidth/workload. The report will be grouped based on Agent and Case Origin/Type(based on your business operation). From here call center manager can easily get real time view of his/her team's current work pressure. Here comes the report -

Average Age of Open Case:
Another very important report to understand your team's performance - how long your agents are taking to serving customers and thus meeting the service-level agreements (SLAs). To create this report, you can customize the out-of-the-box report "Total Open Cases By Agent" and then summarize the Age column (Summarize by Average). Below is how the report will look like -

Average Age of Closed Case by Agent:
Call center managers can use this report to monitor their agent's productivity in terms of how quickly agents are closing the cases. This report will give a very good comparative study of the agents in terms of their productivity. To create this report, you can customize the out-of-the-box report "Total Open Cases By Agent". Remove the Open equals True filter and add Closed equals True filter, then summarize the Age column (Summarize by Average). Below is how the report will look like -

Monitor Email Queues:
If you have email-2-case configured in your organization and your email cases are routed to individual queues as per the case assignment configuration, then you might need to monitor your email queues to understand how many cases violated, what is the percentage of cases(in standard and out of standard) per queue etc.

In order to do that, use the below details in the report -
  • Use Filter: Case Owner contains
  • Drag the field - Violation from Milestone in the report.
  • Create formula field - (attaching the individual screenshots below)
    • # in standard (# of cases without violation)
    • % in standard (% of cases without violation)
    • # out of standard (# of cases with violation)
 












Below is how the report will look like -

Knowledge Reports:
If you have implemented Knowledge in your organization, then you can install Knowledge base Dashboards and Reports from Appexchange. From there you can go to the report folder - Knowledge Reports Package and get all the important reports available to you. Few important reports are -
  • Case count by Article
  • Cases with Articles
  • Recently created Articles
  • Recently Searches by Keyword
  • Article views
  • Article scores
Omni-Channel Reports:
If you have implemented Omni-Channel in your organization, then below are the reports you might need in your organization. 
  • Omni-Channel - Active Users - This report will give the status of all users currently logged into Omni-Channel.
  • Omni-Channel - Agent Email Metrics - This report will give the summary of email average handle time by Agent.
  • Omni-Channel - Agent Time-Outs - This report will give the summary of email cases that Agents did not accept prior to time out.
  • Omni-Channel - Queue Email Metrics - This report will give the summary of email average handle time by Queue.

Monday, June 12, 2017

Salesforce Live Agent Chat - Objects

In this post, I am going to explain about the standard objects which will be created by default the moment you enable Live Agent in your organization. Let's start -

Live Chat Visitors:
This object contains information about the visitors who has initiated the chat session. One important field here is the Session Key. A session key in a unique record which is stored on Live Chat Visitor's record and end user's machine as a cookie. But why? The reason is if the end user is initiating multiple chat sessions, then Salesforce will link all Live Chat Transcripts records (This is another object, which I will explain in a few minutes) to this unique Live Chat Visitor record. Here is a sample Live Chat Visitor record.


Live Chat Transcripts:
This is the record which tells you the conversation that happened between your Service Representatives and End Users. It stores the chat transcripts. Salesforce will automatically create the record for you as soon as the chat session is ended and your service representatives close the chat transcript. Here is sample Live Chat Transcript record.


Live Chat Transcript Events:
This object tracks all the events that occur between Service Representatives and Customer during the chat. Few important events are like Chat Request, Accept Request, Route Information, Transfer information. You can see the detail of events - 
https://help.salesforce.com/articleView?id=live_agent_transcript_events.htm&language=en&type=0
Here is sample Live Chat Transcript Event record.

Live Agent Sessions:
This object holds the information about the agent sessions, time spent online, time spent chat, idle time etc. Here is sample Live Agent Session record.

Quick Text:
Quick Text is a very handy option when chatting with customers. If your Sales Representatives are using few sentences quite a number of times, then instead of asking them to write the same again and again you can create Quick Text. It is basically the shortcut for commonly used phrases/questions.
Below is a sample Quick Text for greeting customers with Good Morning.

Now from the chat window, your Sales Representatives can just enter ;; and all available Quick Texts will be available to them. They can select the one. This was it will help them to respond back to the customer much quickly.




Sunday, June 11, 2017

Salesforce Live Agent Chat - Understand the Basics

Using Live Agent Chat, Sales Representatives can chat with their customers and solve their problems or answer their questions. In today's world providing first class services to customers is very important and chat support plays an important role here. Live Agent Chats are referred as Live Chat as well. With Live Chat, customers don't need to wait for the long queue or need to wait for replies for their email queries. They can get immediate attention which eventually improves customer satisfactions.

Trailhead comes up with a very good project "Build a Branded Chat" which explains how to enable Live Chat and it's basic configurations. I recommend everyone to please go through this one and understand the basic of the Live Agent Chat first before proceeding further.

Below is the visual representation of "Live Agent" Object Model. Though I am saying it "Object Model", but most of them are not objects. :-) 


Let's try to two basic terminologies associated with Live Agent.
1. Skill:
To understand Skills, we first need to understand how we want to support our customers - is it based on geography? Is it based on business units? Is it based on products? etc.. Then based on the answers you will hire employees and train them so that they can support your customers. These peoples are known as Sales Representatives who normally support your customers.

So let's say, the company "Global XYZ" is having business all over the world. They are supporting their customers based on geographies. So for them, they will create skills like - APAC, NA, EUROPE, EMEA.

Again let's say the company "Global Insurance MNOP" is selling Insurance Products. So for them, the skills will be - Health Insurance, Car Insurance, House Insurance.

Now you will assign your Sales Representatives(Salesforce Users) to the Skills. It's a many to many relationships i.e. one skill can have multiple Sales Representatives(Salesforce Users) and one Representative(Salesforce User) can have multiple skills. 

2. Deployment:
A deployment is basically the section where you will place all your configurations to control Live Agent behaviors in your website. Deployments will provide JavaScript codes which you will put in your Web pages.

You can have more than one Live Agent deployments. In case your organization has one Service console supporting multiple sites, you can create Live Agent deployments per site.



Trailhead comes up with an image which I really like and it explains the two pillars so clearly.

Trailhead Modules:


Friday, April 28, 2017

Summer'17 :: Retrieve and Deploy Metadata through Apex


In Salesforce World, Metadata plays a very important role. Metadata types and components are used to represent org specific configuration and customization. Salesforce is having a very good page explaining Metadata. Here is the link - "An Introduction to Force.com Metadata". 

Before Summer'17 release, in order to access Metadata, you need to use the Metadata API, but now Salesforce comes up with Metadata namespace. You can use classes in Metadata namespace to access Metadata components through Apex.

Why do I need to access Metadata?
Salesforce documentation explains it correctly and here are the possible reasons why you may need to access Metadata.

In this post, I am going to explain how you can access and deploy Metadata changes through Apex with an example.

Example -
In my Salesforce Org, I have one Custom Metadata Type named - "Admin Preference" which is -
The values of this Custom Metadata Type are -

Now I will create a simple VisualForce Page which will retrieve this Metadata Values and display them. At the same time from the same page, I will change the values. 

To implement this requirement, I will use the Salesforce Summer'17 New Feature - classes Metadata namespace.

Let's Start -
In order to store the Custom Metadata Values, I will use the below class -

public class MetadataHelper{
    public String name {get;set;}
    public Boolean isEnabled {get;set;}

    public MetadataHelper(String name, Boolean isEnabled){
        this.name = name;
        this.isEnabled = isEnabled;
    }

    public String getFullName(){
        String fullName = 'Admin_Preference__mdt.';
        if(name.equalsIgnoreCase('Process Builder Preference')){
            fullName = fullName + 'Process_Builder_Preference';
        }else if(name.equalsIgnoreCase('Trigger Preference')){
            fullName = fullName + 'Trigger_Preference';
        }else if(name.equalsIgnoreCase('Validation Rule Preference')){
            fullName = fullName + 'Validation_Rule_Preference';
        }else if(name.equalsIgnoreCase('Workflow Preference')){
            fullName = fullName + 'Workflow_Preference';
        }
        return fullName;
    }
 }

How to retrieve the Custom Metadata Types and it's Values: 

To retrieve the Custom MetadataTypes, the command is - Metadata.Operations.retrieve(). This method will retrieve the Metadata synchronously. We need to pass the list of component names and this method will return a list of matching component data (Metadata.Metadata format).

Once you have the list, power is completely in your hand. Trust me!! Really you have all the power you need then. You can iterate through the list and get the each CustomMetadataRecord. Now each CustomMetadataRecord is having CustomMetadataValues which also you can fetch and play around. 
CustomMetadataValues are stored in two fields - the first one is "field" which stores the API name of the field and the second one is "value" which stores the value of that field for that CustomMetadataRecord. Confused??? Don't worry I will give you now a clean picture which helped me to understand and I hope it will help you as well.

To understand how the custom metadata information is stored in Salesforce, consider our Custom Metadata Type mentioned above - Admin Preference. And let's consider one value here - 



So according to the above example - Metadata.Operations.retrieve() will retrieve the CustomMetadataRecord - Process Builder Preference. Now this record is having the label - "Process Builder Preference", which we can get from the label field. The fullName of this record is - "Admin_Preference__mdt.Process_Builder_Preference" which we can get from the method getFullName()
In the above example, this CustomMetadata is having only one value which is stored inside a field of type Metadata.CustomMetadataValue. For that single  Metadata.CustomMetadataValue, the field = 'Enabled__c" and value = true.

So the visual representation of the flow is -


With the above explanation, here comes to code -

How to deploy Custom Metadata Types and it's Values: 
The method Metadata.Operations.enqueueDeployment is used to deploy the changes to the org. The operation is happening in asynchronous mode and that is the reason we need to provide a callback method to handle the success/failure scenarios. To create the callback, we need to implement the interface Metadata.DeployCallback and by doing that we need to put our logic in the method - handleResult.

Below is the CallBack method -

Now to deploy the changes below is the code -

You can find the full code in my Github repository.

With all these changes, below is how the functionality working - 


Limitation - Metadata access in Apex is currently only possible for custom metadata records and page layouts. You can retrieve, create or update custom metadata, but you cannot delete metadata through Apex.


Thursday, April 27, 2017

Summer'17 :: Embed Your Flow in Lightning Experience


In this post, I am going to explain the new Flow features introduced by Salesforce in Summer'17.

Add Flow into Record Detail Pages:
With Summer'17 Salesforce release, now you can add flows into any Lightning Pages. You need to add the Flow component to your Lightning pages. This feature was introduced by Salesforce in Winter'17 release as a beta functionality, and in Summer'17 this is now Generally Available.

In this section, I am going to explain how you can add flow into record details page through Lightning App Builder.

Let's first create a flow which needs a parameter which is basically the record Id. The intention is that when we will add this flow into the record detail page, we will pass the record Id to flow and then flow will fetch necessary information from the record and prepare its own view.
So here is the flow -

Flow Name: Survey Customer
This flow is having one input variable - "recordId" which will store the Salesforce Record Id passed from record detail page.

With this variable, the flow will query the Salesforce Contact Record, fetch Contact's First Name and Last Name and generate the customized Welcome Message. I am not going to show how Flow is configured because the intention of this post is to demonstrate how to use the flow inside Lightning Experience.
Here is the final view of the flow -


Now, will come the fun part. Let's say we wanted to display this message in Contact Detail Page. What we need to do is - Open the contact detail page and then click on the Edit Page option from Top Right.
This will open the Contact Detail page in Lightning App Builder

From the left section, select the Flow Component under Standard and drag it under Activity Section at the button.
Now select the Flow component, and you will see the configuration panel at right next to it. This is the place where you will select your flow and also the parameters you will pass to the flow. See the animation below -
And that's all. Now the contact details page will look like -

Enjoy Flow in Lightning. Please provide your feedback.