Tuesday 8 September 2020

Create your first lightning web component

Arpit Sharma
In this article we are going to create our first lightning web component, So Let's start 

Prerequisite -

1.  We should have VS code installed in our system.
2.  VS code should have required plugin for Salesforce.
3.  Connect your org to VS code

Here are steps to create lightning web component in VS code.

Step 1 - 
Press Ctrl + Shift + P in windows VS code.

Step 2 - 
Type SFDX : Create lightning web component and Press Enter

Step 3 -
Type required web component name, In my case it will be LW_HelloWorld, then press Enter.
It will automatically create below three files - 
- LW_HelloWorld.html
- LW_HelloWorld.js
- LW_HelloWorld.js-meta.xml

Step 4  - 
Paste below code in your LW_HelloWorld.html

<template>
    Hello World
</template>

So here we go, we have successfully created our first lightning web component. In next article we are going to learn, What is use of above each file and how we can run above project.

Saturday 8 September 2018

Salesforce Authentication Using Rest API - Connected App

Arpit Sharma





In Salesforce, REST API uses bearer token authentication to get into Salesforce and perform operation.

Below are the steps that shows how Rest API works
1. Request for Bearer token using connected app configuration and Salesforce credentials.
2. Salesforce response with bearer token.
3. Use that bearer token to get into Salesforce and perform operation.




In this post I will let you know how you can get bearer token with the help of Connected app and credentials. 

Create Connected app 
1.  Go to Setup -> Quick Find -> Apps -> Connected Apps -> Manage Connected Apps

 2. Click on New Connected App


 3. I configure my connected app as below screenshot,you can set up as your requirement.
 Once you click on Save you will get below screen.
c
I have use Consumerkey and Consumer secret from above connected app configuration and salesforce username and password to connect with Salesforce in my java application.

You can connected with Salesforce by using any other application as per your convenience.

Below is Java code that I have created to get bearer token with Salesforce.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
 
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
public class SalesforceRestLogin {
 public static void main(String args[]) {
  try {
   HttpClient httpClientObj = HttpClients.createDefault();
   //end point URL
   HttpPost httpPostRequest = new HttpPost("https://login.salesforce.com/services/oauth2/token");
 
   //set post body
   List<NameValuePair> requestBody = new ArrayList<NameValuePair>(2);
   //set grant type
   requestBody.add(new BasicNameValuePair("grant_type", "password"));
   //set connected app consumer key
   requestBody.add(new BasicNameValuePair("client_id", "connected app consumer key"));
   //set connected app client secret
   requestBody.add(new BasicNameValuePair("client_secret", "connected app client secret"));
   //set salesforce username
   requestBody.add(new BasicNameValuePair("username", "salesforce username"));
   //set salesforce password+security token
   requestBody.add(new BasicNameValuePair("password", "salesforce password+security token"));
   httpPostRequest.setEntity(new UrlEncodedFormEntity(requestBody, "UTF-8"));
 
   //response from server
   HttpResponse serverResponseObj = httpClientObj.execute(httpPostRequest);
   BufferedReader bufferReader = new BufferedReader(
     new InputStreamReader(serverResponseObj.getEntity().getContent()));
 
   StringBuffer responseRes = new StringBuffer();
   String line = "";
   while ((line = bufferReader.readLine()) != null) {
    responseRes.append(line);
   }
   System.out.println(responseRes);
  }catch(Exception e) {
   System.out.println(e.getMessage());
  }
 
 }
} 
 
  
When you run above code then you will get server URL and session id in response, then by using both you can communicate with server for further requests.
Thank you for to come on my blog.
Let me know using comments if you like my article and for suggestions.

Tuesday 7 August 2018

How To Redirect On List View In Lightning

Arpit Sharma


In this tutorial we will see how we can navigate to list view in lightning,

Salesforce recommended us to stop using anchor tag for redirection because of security concerns.

That's why for redirection I used events trigger and but you need to take care because it will not work if we will use it without tabs, home page etc.

So for make it work I have created one component Named NavigateEventComponentExample and used that component on tab. below is code snippet for component.

<aura:component implements="force:appHostable" controller="NavigateEventController">
    <h1 class="slds-m-around_small">Redirect to List View</h1>
    <lightning:button class="slds-m-around_small" label="Go" onclick="{!c.goToListView}"> 
    </lightning:button>
</aura:component>


Let’s understand above component 

1. I used implements="force:appHostable" to make it available for tabs.
2. Go Button that will help us to trigger event firing.

When we will click on above button then goToListView function in controller of NavigateEventComponentExample will call.
Below is code snippet for controller

({
    goToListView : function(component, event, helper){
        var listViewRedirectEvent = $A.get('e.force:navigateToList');
        listViewRedirectEvent.setParams({
         "listViewId": '00B6A000007jQu0UAE',
            "listViewName": 'All_Leads',
            "scope": "Lead"     
        });
        listViewRedirectEvent.fire();
    }
})
 
In above component
1. We have created object for event and by use of e.force:navigateToList we tell event to redirect us to list view when fire.
2. Set event parameters i.e. List view Id, Name and scope(In our case scope is Lead).
3. Fire the event.
Once event get fire then user will redirect to list view of given Id and object.

Let me know if you found any issue in above code snippet and understanding.

Friday 3 August 2018

Why Salesforce Lead Object Is Essential for Success in Sales and Marketing

Arpit Sharma
 


A successful marketing strategy is, by default, useless unless potential clients bite the bait you’ve used to lure them in. Those who have bitten the bait, but have not yet been reeled in are what you would call “leads.” Leads are the building blocks of what could possibly be an actual sales opportunity. But countless of times, certain leads fall short of being converted into “contacts,” those clients who you’ve successfully reeled in.

To create a concrete separation between your “contacts” and your “leads,” here are a couple of tips. On one hand, your relationship with “leads” usually ends as soon as they get a hold of your marketing promotions. Another characteristic common with “leads” is that they can easily be worked by sales development reps. On the other hand, “contacts” are more associated with opportunities, accounts, and revenues.

Fortunately, Salesforce, the SaaS-focused CRM, has got you covered with the filtration of “leads” and “contacts.” The CRM does this through a special feature within its system known as the “Lead Object.” The Salesforce lead object allows for the proper espousing of best practices. By delineating leads from contacts, agents are guided on which clients they are to send certain marketing advancements (i.e. emails, SMS, or voicemails).

How Does Salesforce Lead Object Support Sales and Marketing 

Before getting into why you, as an agent or as a company owner, should use the lead object, let us clear out why some unfortunately opt to do without it.
  • Companies often get overwhelmed with the thought of exerting extra effort in separating leads and contacts. Honestly, this is nothing a quick dialogue between the sales and marketing teams can’t settle.
  • Companies from other industries tend to think that the system only fits the B2B business model. But come to think of it, most industries out there come up with their own marketing plans to invite in potential clients, also known as leads.
  • The only probably exception would be those businesses with a small to no sales team (i.e. eCommerce companies). Often times, these types focus their marketing efforts into creating only a limited yet loyal clientele.
Now, as a responsible and committed leader of your company, here are compelling reasons as to why you need to grab a hold of your pipeline. These are the things that will help you have the reins over your whole sales process, and not the other way around.
  • Salesforce objects allows both sales and marketing teams to aid their agents against confusing old contacts from newly converted ones.
  • The Salesforce lead status assists sales managers in evaluating their team by making aspects of the pipeline (i.e. reps efforts in converting leads into contacts) visible.
  • Salesforce leads are easily distinguishable through the lead status Salesforce provides. This equips your marketing team with the ability to efficiently publish their ROI information.
Weigh both the benefits of the lead object, and the painstaking tasks you manually maneuver through without it. Stop wasting valuable time and start the quicker route to transforming your leads into contacts.

Your Competitive Advantage With Salesforce Lead Object

As time takes its course, we have accepted the fact that the traditional method of face-to-face selling is a rather endangered way of doing business. The lead object takes complete advantage of this, and has made online transactions easier for both agent and client.
  • It gives eases the profiling of leads by providing you codes for each who have filled out your online forms.
  • Leads are assigned an agent depending on their location compatibility among other criteria.
  • Agents are equipped with the lead’s profile which guides them in formulating interview questions that are in context to the client’s field.

What You Should Be Doing to Optimize Your Salesforce Lead Object

  • Make sure that you are actually using it. Companies usually have it, but never seem to get their desired results since they misuse it. Some never even use it at all. Ensure that all agents are using this tool they’ve been equipped with. Always create a Salesforce campaign object for every marketing effort you come up with.
  • Organize your system by segregating leads and contacts into standard “types.” This makes it easier for you to scan through your pool of clients, or potential ones. Also, doing so will allow agents the luxury to not have to constantly create a new “type” for every campaign. Tracking your prospects and opportunities with lead object should be easy, make it so for you.
  • Easily peruse through lead and contact responses. As this CRM function’s lead statuses come with remarks to easily track lead status, your part is to make sure you automate it using web-to-lead forms.
Which Industries Benefit From Salesforce Lead Object?

The common notion that only B2B business models benefit from the Salesforce lead object has been debunked. As long as your business has marketing strategies driven to create a pool of prospects, then you are very much qualified to field in the aid of the lead object. To give you a better look on how this Salesforce feature benefits your industry, here are some examples:

1. Retail
Retail is a very customer-centric industry, and Salesforce is right with you through every step of the way. From marketing to sales—and even until after-sales support service—the CRM assists you in providing both leads and contacts with unparalleled attention.

2. Financial Services
Investing money, big or small, is probably one of the riskiest decisions one could ever make in life. Hard-earned cash is hard-earned cash, so people working within the financial services sector need to earn the complete trust of their clients. Salesforce allows you to understand your clientele on a personal level by systematically grouping their data.

3. Automotive
Cars are one of the rather bigger splurges people make, and for such they expect no less than the utmost attention from their dealer. Salesforce allows automotive companies to tweak their marketing and sales efforts to be able to connect with their clients better. This gives them a better understanding as to what questions to ask and which solutions to provide, for their clients to receive sterling custom
er service.

4. Telecommunications
When it comes to its sales and marketing efforts, the Telecommunications industry is heavily reliant on CRMs like Salesforce in streamlining these aspects of their business. Profiling clients through a CRM makes the process a whole lot simpler as you have all the vital details within arm’s reach.

5. Life Sciences
Even physicians who forge strong bonds with their patients require the aid of Salesforce. Their service needs to be available anytime and anywhere; and a CRM allows that by providing their patients with necessary information and solutions through any device.
Sales pipelines are called such for a reason. The whole process is an interconnection of various stages before leading to the bigger picture, which is the actual sale. And pipelines, often times, need a little cleaning to ensure the smooth flow of transactions. And that’s the main cause for the existence of Salesforce’s lead object. Having a hard time coursing through your sales funnel? Maybe it’s time for you to stop doing things the hard way, and allow the lead object to aid you with transforming that lead into a contact!


Above article republish with permission and you can find original artical on below link

https://www.tenfold.com/sales-reporting/why-salesforce-lead-object-is-essential-for-success-in-sales-and-marketing