2 comments on “Salesforce to Salesforce Integration using Named Credentials”

Salesforce to Salesforce Integration using Named Credentials

We recently had an integration project where we got an opportunity to use “Name Credentials” for one of our clients, to integrate two Salesforce instances. We found it very easy and useful to configure, maintain and implement using Named Credentials to connect two Salesforce Org. We believe it will be useful for you all and so here we are sharing some of the key features and high-level steps to configure “Named Credentials”.

Following are benefits of using Named Credentials:

  • A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition.
  • You can skip remote site settings, which are otherwise required for callouts to external sites, for the site defined in the named credential.
  • Using Named Credential, we can make a call out to an external system without supplying username or Password in the code.
  • By separating the endpoint URL and authentication from the callout definition, named credentials make callouts easier to maintain. For example, if an endpoint URL changes, you update only the named credential. All callouts that reference the named credential simply continue to work.
  • It supports two types of authentication protocols for now: Basic Authentication(Password authentication) or OAuth

To reference a named credential from a callout definition, use the named credential URL. For example: callout:My_Named_Credential/some_path.

Following are the steps to connect to an external system using “Named Credential”:

  1. Create Connected App
  2. Create Authorization Provider
  3. Define Named Credential
  4. Use Apex to connect in 5 lines of code
  1. Create Connected App:
  • Navigate to “Setup | Build | Create | Apps | Connected Apps” and click on New
  • Provide all necessary information
  • In “Callback URL” enter the temporary Salesforce URL. We will come back again on this step later to provide Callback URL
  • Check “Enable OAuth Settings” checkbox to use OAuth
  • Select the scope
  • Save

“Consumer Key” and “Consumer Secret” will be provided once you save this. We need this information on the next step.


  1. Create Authorization Provider:
  • Navigate to “Setup | Administer | Security Controls | Auth. Providers | Create New”.
  • Select “Salesforce” as Provider Type
  • Provide “Consumer Key” and “Consumer Secret” from the previous step
  • In “Default Scope” enter the value as “refresh_token full”. “refresh_token” and “full” should be separated by space
  • Finally, Save

Once you save, it will provide you the set of URLs in “Salesforce Configuration” section on the same page. Copy “Callback URL” and edit Connected App we created in the previous step and set this URL as Callback URL.



  1. Define Named Credentials:
  • Navigate to “Setup | Administer | Security Controls | Named Credentials | New Named Credential “.
  • Provide the name (label)
  • In URL, provide URL of Salesforce instance where we want to Connect
  • Select “Named Principal” as Identity Type
  • In our example select “Authentication Protocol” as OAuth 2.0
  • Select the “Auth Provider” created in the previous step
  • In scope, enter the value as “refresh_token full”
  • Check “Start Authentication Flow on Save” (this is important)
  • Save

After clicking on “Save” a new page will open to authenticate Salesforce Org using OAuth2 connected App. Log in using the credentials of the Salesforce instance that you want to connect to.  If authentication is a success, you can see a message like “Authenticated as ”.


  1. Use Apex code to connect:

Use the lines similar to the below in your Apex code.

HttpRequest req = new HttpRequest();
Http http = new Http();
HTTPResponse resp = http.send(req);

[Note: Perform the first 3 steps in both the Salesforce orgs to be integrated.]
“We @ Techforce Services are specialized in Salesforce Development – Apex, Visualforce and Lightning, API Integrations. We also cover Salesforce Setup, Implementation & Customization”.

Talk to us to know how we can Simplify your Salesforce journey.

0 comments on “Google Integration: General Availability for Lightning for Gmail and Lightning Sync – Part II”

Google Integration: General Availability for Lightning for Gmail and Lightning Sync – Part II

google integration
In my previous blog (Part I) I discussed about Lightning for Gmail – the email integration for Gmail users. In this blog (Part II) we’ll look at Lightning Sync. Lightning Sync keeps contacts and events in sync between your Google applications and Salesforce. When you sync contacts and events between your Google applications and Salesforce, you increase your productivity. That’s because there’s no need to duplicate work between the two applications. In addition, Lightning Sync syncs items whether you’re working from your desk or from your mobile device using Salesforce1. Following are high level steps to configure Lightning Sync in Salesforce: Step 1: Prepare your G Suit account for Lightning Sync The IT pros or Google administrator at your company can prepare Google servers to communicate with Salesforce. Your Google admin can complete these steps by logging in to your company’s Google API Console and Google Admin Console.
  1. Complete these steps from Google API Console
    1. Create a Google project dedicated to Lightning Sync. (https://console.developers.google.com/projectselector/apis/library?pli=1)
    2. From the new project, to set up reps to sync events, enable Google Calendar™ API.
    3. From the new project, to set up reps to sync contacts, enable Google Contacts API.
    4. Create credentials for a service account with the role Project Owner and the key type JSON.
    5. Enable Domain-Wide Delegation for the service account. Doing so generates a Client ID (also known as Client name) for the service account, which you need later.
    6. Save the JSON private key from your service account in a secure location and share it with your Salesforce admin. (But only your Salesforce admin.)
  2. Complete these steps from Google Admin Console
    1. Navigate to your security settings, select the advanced section, and click Manage API client access.
    2. Authorize read-only calendar scope for the service account by entering the service account Client ID (also known as Client name) you generated in Google API Console. Enter the scope:
      1. https://www.googleapis.com/auth/calendar.readonly
      2. https://www.googleapis.com/auth/contacts.readonly and https://www.google.com/m8/feeds
When you’re finished, Salesforce admins can take the next steps by preparing Salesforce for Lightning Sync. Step 2: Prepare Salesforce for Lightning Sync After an IT pro or Google administrator has prepared your Google for Work account for Lightning Sync, complete the necessary steps to prepare Salesforce, too.
  1. From Salesforce Setup, Register a new remote site for https://www.googleapis.com. Don’t disable protocol security for the site, or Salesforce can’t connect with Google.
  2. From Salesforce Setup, enter Lightning Sync Setup in the Quick Find box, then select Lightning Sync Setup.
  3. Enable Lightning Sync.
  4. Select OAuth 2.0 for Google (Beta) as your preferred connection method.
  5. Upload the private key for your Google service account. Your Google admin generated the key when setting up the service account for Lightning Sync.
  6. Click Save.
When you’re finished, run the Lightning Sync connection test to make sure that you’ve setup your connection correctly. After your Salesforce admin initiates contacts sync for you, Lightning Sync creates a group in Google Contacts called Salesforce Sync. Any contacts that have synced from Salesforce to Google are found in the Salesforce Sync group. Gmail™ accesses those contacts automatically when you attempt to email or chat with those contacts. Or if you are setup to sync from Google Contacts to Salesforce, you can add Google Contacts to the Salesforce Sync group, and Lightning Sync starts syncing the contact with Salesforce during the next sync cycle. Note: Don’t rename, move, or delete the Salesforce Sync group, or syncing between Salesforce and Google Contacts could stop. Setting both Lightning for Gmail and Lightning Sync lets you choose which Google Calendar™ events sync to Salesforce. When you relate Google events to Salesforce using Lightning for Gmail, edits made in Google Calendar sync back to Salesforce, keeping important Salesforce events up to date automatically.   References:
"We @ Techforce Services are specialized in Salesforce Development - Apex, Visualforce and Lightning, API Integrations. We also cover Salesforce Setup, Implementation & Customization".
1 comment on “Google Integration: General Availability for Lightning for Gmail and Lightning Sync”

Google Integration: General Availability for Lightning for Gmail and Lightning Sync

lightning for gmail

Collaboration in the workplace is nothing new. However, it is becoming increasingly important in the modern world as we become more connected around the globe.Lightning for Gmail is now generally available, and with our latest features, your team gets a boost in productivity. And reps get to relate emails to Salesforce before sending them.

0 comments on “Cloud Computing”

Cloud Computing

Cloud computing is transforming modern business. Through the cloud, new digital-centric businesses are emerging that are more agile and innovative than anything seen before. Whether a new, ‘upstart’ business like
Techforce Services, with its compelling approach to leveraging cloud in delivering CRM (Salesforce) solutions; or an established company breaking into new markets, like Oracle, IBM with its investment into cloud services, businesses are pioneering new customer services and business models that are disrupting entire industries and changing the way we work and play. Enterprises are now on an accelerated modernisation path, trying to maintain, and even extend, their lead as other digital and data driven organisations challenge their status. For established enterprises, this is a particular challenge: they are not start ups that can live exclusively in the clouds. They have legacy systems and applications that cannot be virtualised and migrated to the cloud and customers who rely upon the flawless and ceaseless delivery of their digital services. Furthermore, due to governance, regulatory, and compliance (GRC) requirements some of the digital assets have to stay on premise. Therefore, the road ahead is more complicated than simply migrating infrastructure and applications to the cloud.
The challenge for businesses are that companies rely on a mix of public cloud services providers, private cloud and on-premises legacy technology. With more and more systems relying on the performance of external services, it’s a challenge to pin down the root cause of a service interruption when it occurs, as it relies on the consistent performance of multiple elements both on and off of your premises.
Despite the benefits of this hybrid environment the reality is that it can cause an enterprise to lose sight of service vulnerabilities. What is needed is a holistic end-to-end view of the entire service delivery infrastructure. Without this visibility, service failure and even criminal activities, such as hacking and Denial of Service (DoS) attacks, can go unnoticed. With so much of modern business activity reliant on the effective operation of the network, it is vital to be able to identify and address issues quickly and effectively.  
The right approach to service assurance overcomes this challenge by providing a holistic visibility across the entire service delivery infrastructure from the wireless Edge to the Core and in the Cloud. This is achieved by continuous end-to-end monitoring and analysis of the traffic data flowing over hybrid cloud networks. This enables enterprises to spot and isolate any anomalies that may present a hindrance to business performance. Translating real-time smart data into actionable insights is of huge strategic value to the enterprise both in terms of productivity and revenue
"We @ Techforce Services are specialized in Salesforce Development - Apex, Visualforce and Lightning, API Integrations. We also cover Salesforce Setup, Implementation & Customization".