Sunday, 16 August 2015

Lightning Connect Apex Adaptor

If your organization has already subscribed to the Lighting Connect feature(This is available based on Subscription with additional fees .Contact your salesforce AE to learn more ) to create External Objects,it is good to know that apex can be used by your developer to expose data from any system which uses SOAP or REST as external Objects .

The advantage of using External Objects will be saving some storage space .The data will not reside inside salesforce but can be viewed in salesforce User Interface just like any other objects .

There are number of limitations worth noting before you decide to go with external objects and salesforce documentation can help you in regards to this 

There are lot of chances that you need data only for reading from external system and may later run apex to convert few into transaction data .One of the ways to address this business use case can be using lightning connect .There may be millions of data and with lightning connect you can keep it outside salesforce but still use salesforce interface to view ,search and use apex to convert some to SFDC native objects .

When lightning connect feature was launched you needed an adaptor to convert data into Odata before you could actually consume and bring into salesforce as an external object.

Its good to know you dont need an Odata now and an apex written by developer can be used by salesforce administrators to bring any data via SOAP or REST to salesforce .

Aim of the blog Post:

   The main aim of this blog post to show an example to developer community on how to extend  data source provider and data source Connection classes to build external data source in salesforce.

We will connect to a simple REST end point available for Non commercial financial  purpose .To explore more about this webservice please read below 

Exchangerate Lab provides us free end point for non commercial use to fetch some data that shows latest currency rates for selected Currencies .Please note the aim of calling this webservice is just to demonstrate the Lightning connect feature.

  • The first step is to create a DataSource Connection class.

The Connection class will provide 
  1. Metadata definition of the external schema which admin of salesforce will generate based on need by just clicking a button
  2. Query method to query the data from API.
  3. Search method to implement the search via global search
  4. Filters and pagination if needed can be implemented in query and search methods
  5. Write a JSON parser for mapping data to fields
The below code is self explanatory and it connects to exchangedate labs to fetch currencies and exchange rates

  • The next step is to create a Data source Provider class that describes the functional  abilities like authentication mechanism ,capabilities provided by the data source
The below code shows an example class and format 

The below shows the video on how Admin will configure with simple clicks for magic 


Monday, 10 August 2015

TrailHead Goodness

Most of my friends who come from Java world into apex often ask me about where can they find quick tutorial on CRM lifecycle and quick hands on tutorial on how to use Account Management ,Contact Management ,opportunity management and so on.

TrailHead has got some modules now to explain all of this in depth .

Lets summarize each of the modules and see what they help us learn

Account & Contacts

If you quickly want to learn how to create some Test Accounts and Contacts and understand relationship among them worth spending your half an hour with this module

CRM Basics

Now this may sound silly if you know the concepts but fact is most of developers we dont think of business case for which we spent hours writing code .The basics of salesforce starts with knowing CRM .This module for me should have been first module of TrailHead .Never too late .Grab a coffee and spend some time working on this Trail Badge .

Leads and Opportunities

I would open this module for Training end users .Before we onboard our sales or marketting team ask them to get this badge and I am sure this will help them to gain better understanding on how salesforce will increase their productivity.Explain them the significance of keeping data clean and ask them to create some test data in training environment before they start using the system in their Production Environment .

Event Monitoring

If you are a system architect I would recommend you to learn more about Event Monitoring module .This will give you great insight of how to track various events like login ,logout ,usage of API ,UI clicks .All this will help to draw inference about how the system you have built is being adopted .

Adoption is key metric and this module will help you understand how to pull event log files from SFDC and how to report and analyze reports .

Finally if you are going to dreamforce how cool it is to gather information prior to that and do some homework.Dreamforce module is amazing way to prepare you for this .

If you are a geek and Nerd ,then do some Projects and get hands dirty .Follow the Trailhead Project link below

Finally grab all Trailhead badges as I did and beat me up :))

Introducing Lightning Base Components

Lightning Base Components are great addition to the platform and in fact revolutionary .One of the concerns around lightning component ...