Search

Vineet Goel Cloud Evangelist

LIVE AGENT IMPLEMENTATION

Now a days, people need immediate replies and solutions, hence they would like to chat with the executive to get immediate resolution, hence Live Agent provide users the ability to interact with the agents through web chat to get more information about specific product or queries. In this article I will go through how to setup Live Agent and various concepts related to it.

First of all, you have to enable Live Agent in your org.

  • Click on Name | Setup | App Setup | Customize | Live agent | Settings
  • Click on Enable Live Agent check-box as shown in below screen shot

live1

As soon as, you enable this feature few object auto created for your organization, those are

  1. Live Chat Visitors: The Live Chat Visitor tab contains information about visitors that have participated in chat sessions.
  2. Live Chat Transcripts : The Live Chat Transcripts tab contains the transcripts of completed chat sessions.
  3. Live Chat Transcript Events: Contain all information that contains  chat request,accept request or route details  and Visitor Left.
  4. Live Agent Sessions: This Live Agent Sessions tab contains information about agent session, time spent online , time spent on chat etc.
  5. Live Agent Supervisor :This tab contains information about your department’s chat buttons and chat agents, all in one place.
  6. Live Agent : This tab contains information about Chat transcript and from here you can launch live agent console.
  7. Quick Text : Quick Text lets users create standard messages, such as greetings and answers to common questions, which support agents can easily insert into communications with customers. Quick Text is automatically enabled for organisations that have enabled Live Agent. If you want to create quick text click on Quick text (Tab) | New and fill the details as per your choice.

Now create one App, which is a console app, where we include Live Agent.

 

live9
Include Live Agent in this App

When you enable live agent for your organization , next step is create user or grant existing user to required permission so they can work as live agent. To do that go to user record and select live agent user (feature licenses) check-box as shown in below screen shot

live2.jpg

Enable skills and assign them to users

Skills classify the abilities of agents based on that you can route requests to the right set of agents. For example, if your support center handles both technical and non-technical issues, you would create separate “Technical” and “Non-technical” skills, and assign agents accordingly. Then, when a query comes in that requires technical expertise, Salesforce routes the request to those agents in the “Technical” skill set only. To create Skills follow the below instructions

  • Click on Name | Setup | App Setup | Customize | Live agent | Skills
  • Click on New button, it will redirect you to a new page from where you can create new skills
  • Enter Name, Users and Profile that have this skill then click on Save ,as shown in below screen shot

live3

Chat Buttons and Automated Invitations

You need to create the buttons that visitors click to start chats. A button consists of several lines of JavaScript that you copy and paste into Web pages. Each button lets you refine the chat experience for visitors. For example, your organization could have different buttons for personal computer, laptop, or tablet issues. Each button is mapped to a different skill to make sure that visitors’ inquiries only go to agents who have the ability to solve their problems. To Create Chat button follow the below instructions

  • Click on Name | Setup | App Setup | Customize | Live agent | Chat buttons and Automated Invitations
  • Click on New button, it will redirect you to a new page from where you to fill all required details to create new chat button

live4

live5.jpg

I have included Online/Offline Image by saving them in Static Resources and linked it to a Force.com Site. When you click on Save for Chat Button, then Chat Button code gets generated.

live6

Now create Deployment, follow the below instructions

  • Click on Name | Setup | App Setup | Customize | Live agent | Deployments
  • Click on New button, and fill all required details as shown in below screen shot

Click on Save and Deployment code gets generated.

live7

Create a HTML page with “Chat Buttons” and “Deployments” code as per below

live8.jpg

Now we are good to go, I will open the Live Chat Console and have Live Agent Available.

chat1

I have saved that HTML file, when I click on it, based on the agent availability, system will show me either Online or Offline image.

chat2

When I click on this image, it will send the request to initiate chat with Agent.

chat3.jpg

And this is how Chat has started as per below.

chat4.jpg

Key Notes:

  • Live Agent User should be checked on User record.
  • Skills which has been created, should be included in that Chat button.
  • Live Agent can be stored in Browser cookies hence at times you need to delete the cookies and start all over again.
  • Live Agent users require API Enabled administrative permission on profile.
  • Agents also need at least the “Read” permission on Live Chat Visitors and Live Chat Transcripts to review visitor and transcript records.

Automation Using Visualflow

Today, I am going to discuss one use case to automate the scenario using Process Builder and Flow.

Use Case: Universal Container provide support to their  customer by creating cases in their org. Now As soon as Triage team or customer log the Case/Problem, it must have been assigned to a support agent, so here is the scenario, as soon as it gets assigned to the agent, he/she should follow it automatically, which states that even if agent doesn’t know but they gets the email about the update on the case.

I will be doing this using process builder and then calling the flow.

Below is my process builder.

process1

I have used the criteria “When the record is created or edited” so that if we change the owner of case later on then also new owner will also be following the case.

process2

Here the criteria has been set in that way

  • Support agent  profile only get these cases.
  • Owner gets changed.

Then we will be calling the Visualflow. Now let me tell the brief, why there is a need of using Visualflow here, Process Builder can be used to make a record update, create on the object where we are checking the criteria or the related Lookup object. But here we need to check process3.jpg on the case object.

This ‘Follow’ checkbox will be for every standard/custom object where Feed Tracking is enabled.

Follow is on Standard Object “EntitySubscription” which is not particularly related to only Cases that’s why we use Flow.

process4

Mentioned above I am passing this value in flow variables and do “Record Create” in flow as below

process5

Once you Activate both, Create case as below

process6

When Support Agent gets changed then we will seeprocess3 button.

process7

Bingo!!! The New case owner is Following the case.

Please let me know if you want to understand something else in this or you can come up with any other questions as well.

I will give my best efforts to answer you.

Happy Automation!!!

How to get access token for Oauth Username/Password flow

OAuth (Open Authorization) is an open protocol to allow secure API authorization in a simple and standardized way from desktop and web applications. The Force.com platform implements the OAuth 2.0 Authorization Framework, so users can authorize applications to access Force.com resources (via the Force.com REST and SOAP Web Service APIs) or Chatter resources (via the Chatter REST API) on their behalf without revealing their passwords or other credentials to those applications. Alternatively, applications can directly authenticate to access the same resources without the presence of an end user.

In layman language, OAuth is sometimes described as a ‘valet key for the web’. In the same way as a valet key gives restricted access to a car, allowing the valet to drive it but not open the trunk or glovebox, OAuth allows a client application restricted access to your data at a resource server via tokens issued by an authorization server in response to your authorization.

Salesforce provides various flow, you can use OAuth 2.0 via one of six authentication flows:

  1. Web Server Flow
  2. User-Agent
  3. JWT Bearer Token flow
  4. SAML Bearer Assertion Flow
  5. SAML Assertion Flow
  6. Username-Password Flow

Here we will only talk about “Username-Password Flow”, later on other post we will discuss rest of the others.

Username-Password OAuth Authentication Flow

The username-password authentication flow can be used to authenticate when the consumer already has the user’s credentials.

oauth1.jpg

First of all we need to create Connected App in our org. Now question arises, why to create connected app.

To authenticate using OAuth, you must create a connected app that defines your application’s OAuth settings for the Salesforce organization. Which explains that everytime you have to get connected with salesforce through third party using OAuth then you have to create connected app for the same. More information is provided in the link here.

I have created one app in my org as below

oauth1

I have installed Chrome Extension Advanced REST Client (ARC) to make a call to get the access token(SessionID).

Below is the request I made from ARC.

oauth2

When I send this request, received below response with access_token, instance_url, id, issued_at and signature.

oauth3

Post that we can use the access token to get access of the org.

Suppose here, I am trying to make a query call, hence took that access token and made a GET request as below:

oauth4

Response:

oauth5

Key Points:

  1. Request URL should “https://login.salesforce.com/services/oauth2/token” and for Sandbox it should be “https://test.salesforce.com/services/oauth2/token”
  2. Please append the security token with the Password in password section. How to Reset Security Token.
  3. grant_type should be equal to “password” only.
  4. SessionID should be mentioned in Content Type :Authorization with word “Bearer”

I will discuss other flow in later blogs for sure.If you have any issues while doing this flow, please post I will take it up.

Hail Salesforce, Hail Integration!!!

Best Practices that must be followed while Building Flows

I have always found Flows to be easy to conceptualise, challenging to build, and tricky to troubleshoot. Don’t get me wrong because it is an incredibly versatile feature but if not implemented right, it might get frustrating to deal with the resulting issues later. And that is exactly the reason why I try my best to follow certain best practices when building Flows:

1. BULKIFY YOUR FLOW

Flows are subject to governor limits and similar to Apex, you need to ensure that the Flows respect those limits otherwise there can be consequences. Be it auto-launched flows or screen flows, both should be designed in a manner where they only query, create or update the needed records and do not perform a superfluous action. Listed are a few ways via which you can improve Flow optimization:

a.) Always prefer the Fast elements over Record elements(Fast Lookup, Fast Create, Fast Update)

You must have come across the common governor limits in Apex. For example, one should never do a SOQL query  or individually insert/update Sobject variables inside a For loop otherwise a SOQL 101 error or > 150 DML operations in a single transaction issue becomes inevitable. Remember that when you are creating Flows, you are sort of writing Apex via the UI so similar concepts/limits apply to Flows as well. A Record Lookup or Record Update or Record Create element should be avoided inside a Loop element at all costs. Let’s assume a scenario where you have to do a bulk update on Opportunity Line Items within a Flow. One way is to loop through the Opportunity Line Items collection and update each element within the Loop using a Record Update element. But that would be bad design. Reason? If someone performs a bulk upload of 200 records using Data Loader and that triggers our Flow to update the corresponding Line Items, the upload would fail with the “Too many DML statements: 151” error. And this is why we must use Assignment elements to store each updated Opportunity Line Item in a collection variable and then save the bulk update to be handled outside the Flow by using a Fast Update element.

flow1

b.)Be specific with Process criteria when working with Auto Launched Flows

When working with Auto Launched Flows, you should always limit your Process criteria to only work on records which need Processing. Unlike workflow rules which aren’t subject to governor limits, you cannot be relaxed when designing Process criteria. For example, let’s say our Process is launching a Flow that updates a field on a record. Once the field is updated, there is no need for it to be updated again via the Process/Flow. If your current criteria looks like the following:

AND(
[Account].RecordType.Name = ‘ABC’,
TEXT([Account].Industry) = “Agriculture”
)

Then do consider changing it to:

AND(
[Account].RecordType.Name = ‘ABC’,
TEXT([Account].Industry) = “Agriculture”,
ISBLANK(Field_to_be_Updated__c)
)

The latter will only fire in certain instances where the Field_to_be_Updated__c hasn’t been already updated by our Process/Flow. Saves us some unnecessary transactions, doesn’t it? I would recommend evaluating all such Processes for criteria optimization. in your org that launch a Flow.

c.)Use Decision elements to only Update when needed

The above optimization shouldn’t be limited to the Process criteria only and must be transmitted to the Flow as well. Be it auto launched or a screen flow, only the records that need to be updated, should be evaluated and updated within the Flow. A great way to ensure such behaviour is to use a Decision Element prior to the Record/Fast Update and only modify those records that need an update. Again, having an update where a Flow is called every time a record is edited (rings a bell?) is bad design unless it’s really needed.

Here are some other great tips on overcoming the governor limit issues related to Flows:
Receiving “Too many SOQL queries: 101”

Now if your Flow still fails after following all of the above guidelines, I am afraid that the only option is to enter the world of Apex. So either build the entire logic using code or invoke the Apex method from within the Flow by using Invocable Actions.

2. PERFORM NULL CHECKS

NULL checks need to be handled extremely well within Flows so try to plug them into as many areas as possible. When it comes to Decision elements, it’s always ‘the more the better’. So the more the number of relevant Decision elements in your Flow, the lesser are the chances of the Flow failing due to hitting governor limits or missing a NULL check.

Similar to Processes, especially when dealing with collection variables, fast lookup and fast delete elements.

Example Scenario : Find all Account records where Name contains ‘ABC’ and then delete them.
Problem : There is always a possibility that no account exists that contains ‘ABC’ in its name so the Fast Lookup element wouldn’t find anything and the Fast Delete element would have nothing to Delete. And then you get an un-handled exception message/email.
Solution : Use a Decision element to perform a NULL check

flow2.jpg

flow3

Again, as a golden rule of thumb, always consider and handle NULL checks while you are designing the flow and not after you have completed implementing it. Believe me, it will make your life much easier in the long run since Flows are undeniably complicated to debug and troubleshoot.

3. USE FAULT ELEMENT

Salesforce sends the last modifier on a Process/Flow (usually an Admin) a nice comprehensive E-mail with the exception details if the Flow fails. Now this is a great feature that Salesforce added recently to help debug/troubleshoot Flows but this is what it looks like to the front end user when working with Screen oriented Flows:

flow4

Not too graceful exception handling, right? Users working with Screen Flows should always be displayed a better and more sensible error message when the Flow fails. Here’s a fantastic help article from Salesforce that explains how to handle such exceptions:
Customize the Error Message for Running Flow Users (Best Practice)

Following is a great resource as well:
Other Examples of Error Handling in Flows

4. USE STEP ELEMENT

Think of the STEP element as a sticky note or a placeholder that is used to illustrate the logical flow of a business process. It doesn’t hold any value in an active Flow but is definitely useful when doing the initial design of a Flow. Let’s say a stakeholder or a product owner is interested in viewing the series of steps based on which the Flow will be built. Without actually building out the Flow, you can create a rough draft using the STEP element and demonstrate it to the stakeholders. Once approved, you can then hover over the STEP element and convert it into Screen elements using the double arrows. When working with Screen Flows, it is recommended that you first build a visual prototype using STEP element to provide more clarity into the future modifications/design.

flow5

flow6

I can assure you that if you follow the above best practices, you can avoid majority of the common issues associated with Flows. I strongly feel that Salesforce still has loads of improvements to make to both Process Builder and Flows to make them as robust and user friendly as other stable features like Workflow Rules but I definitely like them for the powerful capabilities that they offer; something that could only be accomplished via Apex/Visualforce in the past. Please feel free to share any other best practices that you feel necessary when working with Flows. I also believe that there are user stories at salesforce end must be going on as error handling of flows is not good hence to give the most prominent error to their users will increase it’s usefulness.

Until the next post, keep working with Flows!!!

Just-in-Time Provisioning for SAML (Single Sign on)

Today, I will be giving brief idea about JIT Provision for SAML. Just-in-Time says to create regular and portal users on the first time they try to log in. This eliminates the need to create user accounts in advance. Let’s say employees have joined the company recently and you don’t want to create those users in salesforce. When they log in with single sign-on, their account is automatically created for them, eliminating the time and effort with on-boarding the account.

In technical,With just-in-time provisioning, the end user identity is provisioned (created or updated) at the service provider the first time the end user tries to access the service provider’s service—without the need for prior identity provisioning activity between the identity provider and the service provider.

Also with just-in-time provisioning, the identity provider can include attributes needed by the service provider for provisioning the end user. These attributes can include information such as the user name, first name, last name, and email address, and are packaged in a security token such as a Security Assertion Markup Language (SAML) assertion. The identity provider sends this SAML assertion to the service provider when the end user accesses the service provider as part of a single sign-on. If no match exists for the presented user name, the service provider creates a new account with the end user attributes contained in the SAML assertion. The service provider also immediately grants access to the requested services to the end user.

If a match is found and an account does exist for the end user, the service provider updates the account according to the attribute information in the SAML assertion. A wide variety of attributes are supported (for example, a profile ID can be specified for new or existing accounts); therefore, the federated business partners have fine-grained control over the account creation and update process.

This is enhanced version of Federated SSO  wherein you can just make login and user Creation/Updation takes place. In use case, we will be making login call and user creation of a standard/community user.

I have set up the configuration in salesforce as below while making a call from AXIOM

sales1

 

I have enabled User Provisioning and used Standard JIT handler, we will talk about Custom JIT later on.

Below is the parameters I am passing through Axiom for creating Standard User.

ax1ax3.jpg

As soon as this request will be sent to salesforce, it will create user and make a login call in salesforce.

sales2

Similarly, I make a login call for community. We need to change the Recipient URL to the Community Login URL generated automatically in SSO settings and below is the format of sending request.

ax6

 

 

SAML Request generated and it created the user in into the org and logged into the Community as below.

sales3

sales4

The similarly the request will be sent from third party to salesforce customer portal.

Key Notes:

  1. Recipient URL should be mentioned correctly.
  2. Parameters in Additional Attributes should not be ended with “;”
  3. Fed ID mentioned in Axiom should be unique.
  4. The user which got created with Created by as “Automated Process”
  5. JIT handler attribute mentioned here.
  6. Here is the guide for Just-in-Time Provisioning for Communities
  7. Here is the guide for Just-in-Time Provisioning for Portals
  8. How system matches user in salesforce is mentioned here.
  9. JIT provisioning errors details.

 

Although there is too much to learn in JIT Provisioning, here I am giving you basic concepts so as to learn easily and understand it.

 

 

How to get started with VISUALFLOW

Here in this blog, I will start giving you some details about VisualFlow Designer (Visual Workflow)

I will not go into the details about the difference between Workflow and Visual Workflow? But you can find details here.

Visual Workflow lets you automate business processes by building flows and distributing them to the right users or systems. A flow is an application that can execute logic, interact with the Salesforce database, call Apex classes, and collect data from users. You can build flows by using the Cloud Flow Designer.

Here is a Use case here in which Flow will called through Process Builder.

Universal Container wants when the user is created or edited, it will check if the user is active and User Type(custom field) is SALES then a permission set will get assigned to this user.

Below is the process builder where I have mentioned the conditions.

process1

I will be calling VisualFlow in Immediate Action. In order to do that I have to create one Visualflow.

There are various option like Record Create/Update/Delete/LookUp and Fast Create/Update/Delete/LookUp in Palette. In this Scenario I want to create the record on PermissionSetAssignment Standard object. Hence I will dragging Record Create Element from Palette and dropping it into the canvas, a screen will appear as below to add the details.

flow1

To Create the record I have to pass UserID to the AssigneeId and hardcoded a particular Permission Set. I have create one variable “UserID” to pass the value, in the next screen you will understand why I have used this variable.

Now I will save this flow and Activate it, until and unless you activate it, it will not show up in Process Builder to call.

process2

In above screen you will see I have called the flow which I have created, as soon as I select the name of the flow, all the flow variable which I have defined there will show up.

I am passing the user ID into this flow variable when the user is created. Now I will save and Activate this process builder.

process3process4

This user Vinod has no Permission Set, when I change the User Type to “sales” then permission set should be assigned.

process5process6

Permission Set has been assigned based on the Process Builder.

Key Notes:

  1. Process builder and Visualflow should be activated.
  2. Only AutoLaunched flow will be visible in Process Builder to call.
  3. No Screen element can be used in the flow which will called through Process builder.
  4. Id need to be pass through process builder into the flow variables.

This Flow with Process builder is just to give you a start to learn the VisualFlows, Many more to come!!

 

 

 

 

BULK API call through Workbench to create Bulk Job

There are multiple ways to make Insert, Upsert, Delete call through Workbench or Dataloader. But Dataloader is used to make DML call in XML format only. But what if you want to make a Bulk API call in JSON format which creates Bulk Job in your org and make a Insert/Upsert/Delete call.

Here I will be discussing regarding Bulk Job Creation from Workbench by making a Bulk API call which is in Json format.

Here is the demo of doing that through Workbench. You can anytime install the Workbench Chrome Extension to login automatically by just clicking through extension.

1. Get Session information as below:

workbench1

2. Copy the sessionID and goto REST explorer.

workbench2

3. Pass the sessionID in the header as per below format.

workbench3

Pass the SessionID in “X-SFDC-Session:{SessionID}”

4. Most Important part is to change the Endpoint URL to “/services/async/36.0/job” and pass the request body as below. Here in this case I am taking a simple scenario of Inserting an Account. As soon as you Execute the below request, you will get the response with the bulk job created in your org.

workbench5

sfdc1

5. Copy the Job ID and paste in endpoint URL where you will create batch for this Bulk Job.

“/services/async/36.0/job/{jobId}/batch”

workbench6

Below is the response: Insert call has been made by creating batch of the Bulk Job and status of the Batch has been completed although the Bulk Job is still in Open State.

workbench7

sfdc2

6. You can check the result through Workbench as well by creating a GET request.

“/services/async/36.0/job/{jobId}/batch/{batchId}/result”

workbench8

7. After performing the actions, if you want to close the job then you can close by sending the below request.

workbench10

Key Notes:

  1. The Request sent to salesforce are CASE SENSITIVE.
  2. Space between the Session ID and ID should not be there.
  3. If you are not able to get the SessionID through workbench (Session information) then get through this statement “system.debug(userinfo.getsessionid());” in Developer Console to test.
  4. This call have been introduced through Java by Salesforce. Check this in Async API Walkthrough.

 

 

 

 

 

 

 

Joined TRAILHEADX Live Streaming

It has been first ever Live Streaming of an salesforce event (Developer Conference), which make me think of how fast Salesforce is growing in India.

There was a shout out in India when Marc Benioff was addressing, correspondingly, Parker Harris.

IMG_6714

Then the Editor-in-Chief (Chris Duarte) and Product Manager (Samantha Ready) was addressing about their love to word “RAD”.

IMG_6710IMG_6713

Whenever these kind of conferences came in salesforce, it will always unleash the new features introduced which make us worry, how are we going to learn each and every thing. That’s pretty obvious that no one can learn every bit of Salesforce. That’s why salesforce has various Product Manager/ Owners for different platform.

Here we are enjoying with the props with Atul Gupta (Founder of New Delhi Salesforce UG)

.eJAITziR_400x400

IMG_674013417414_10209861573234811_4782675969785477065_n

Last but we cannot forget where salesforce is famous for “GOODIES”

IMG_6721

Hail SALESFORCE!!

Summer’16 Process Builder Multiple Criteria

Summer ’16 has not only changed the logo in process builder but also added new feature in it.

Before going to the problem let me show case the problem faced earlier.

Consider a situation where we need to create a task when Opportunity Stage is Prospecting and send an email to owner if  Opportunity Stage is Qualification.

Process builder can have only one criteria with true and false condition. There is no way to define new criteria which will run along with previous criteria as shown in below image.

Screenshot1

Above Process Builder is Spring’16 with single decision criteria

Checkout below image, now, we can have multiple decisions in same process builder and no need to create multiple processes for same object. Make sure until n unless you mention the False condition, you will not get the option to Evaluate the criteria as per below image.

Untitled.png

I really hope that this feature will solve various problem of adding multiple criteria at one go.

 

Create a free website or blog at WordPress.com.

Up ↑