Salesforce create a case in a different way

Salesforce provides the best approach to manage the customer query or you can say it is the best CRM to handle the customer query. and create a healthy relationship between the customer and the product. we will be discussing a couple of Basic structure in salesforce to manage any cases.

Let’s start with case generate flow

How to get the cases from Customer?

There is two way to do that.

  1. Web to case
  2. Email to case
  3. Using Rest API

Web to case

This is the very simple to get the case from the end user.salesforce provide the user interface where you can select the data field to get the data from user.we just need to use the web to case HTML generator and we will get the HTML template.Here we can also set the success redirection rule with captch security.once you generate the HTML it will give you the complete HTML structure with selected fields.

Email to case

This is very simple and this method is quite used.Here we just have to configure the email routing and salesforce will give you the routing email address and that address can be used to get the cases in salesforce.

Here salesforce provide us two option to select the email to case

  1. On-Demand Email-to-Case
  2. For Email-to-Case

On-Demand Email-to-Case: It allow process customer emails up to 25 MB. On-Demand Email-to-Case automatically shortens email text to 32,000 characters. Contact Salesforce if you’d like this limit raised to 128,000 characters for your organization.

While setup the on demand email to case we have option for Thread ID just check it to true.This helps us to add the Emails to a case when customer responds.

Email-to-Case: Email-to-Case requires downloading the Email-to-Case agent. It keeps email traffic inside your network’s firewall and accept emails larger than 25 MB. You must install this agent on your local machine to allow Salesforce to process e-mails.

Note:
— Once enabled
Email-to-Case cannot be disabled. However, you can turn off the on-demand service at any time.

— Maximum number of emails converted to cases each day using On Demand Email-to-Case is equal to the number of user licenses in the organization multiplied by 1,000 (up to a daily maximum of 1,000,000).

— While using the API or Apex, you can send individual emails to a maximum of 1,000 external e-mail addresses per day. Individual emails sent using the Salesforce application are not included in this limit. There is no limit to sending individual emails to contacts, leads, personal accounts and users in your organization, directly from account, contact, lead, opportunity , cases, campaign, or custom object pages.

Using Rest API

With the help of Rest Api we can also create the case.Salesforce provide the standard Rest API to create the cases.

To Create the case using API we have to generate the token and to generate the token we need the CLIENT ID and CLIENT SECRET. To know how to generate this please go through with this.

Set up a connected app in Salesforce and get the Client ID and Secret. Create an API only user and get the username, password, and security token.

Note: the password in the request includes password & security-token combined.

POST /services/oauth2/token HTTP/1.1 
Host: login.salesforce.com X-PrettyPrint: 1
Content-Type: application/x-www-form-urlencoded
grant_type=password&
client_id=CLIENT ID;
client_secret=CLIENT SECRET;
username=USERNAME;
password=PASSWORD

Response

{
"access_token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"instance_url": "https://yourdomain.my.salesforce.com",
"id":"https://login.salesforce.com/id/XXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXX",
"token_type": "Bearer",
"issued_at": "1454735969118",
"signature": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX="
}

Call the create Case RestAPI with access_token from the previous step

Use the instance_url and the access_token from the previous step to make the call to create a Case.

Use access_token in Authorization Header as Authorization:

Bearer <access_token>

Use the <instance_url> along with the endpoint to access the intended API.

Create Case RestAPI request

POST services/data/v42.0/sobjects/Case 
Host: <instance_url>
Authorization: Bearer <access_token>
Content-Type: application/json
{
"Subject": "Ranbir Need Help",
}

Response

201 Created
{
"id": "a002800000PArty550n",
"success": true,
"errors": []
}

That’s it, you’ve created a case using RestAPI.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ranbir Kumar Das

Ranbir Kumar Das

260 Followers

I M Believer, Helper, Chaser, Thinker, Rich, Explorer, Prayer, Boss, Freedom, Fearless, Investor, Faith, Creator, trillionaire, CSM, Salesforce certified