Introduction to Salesforce DX
Mar07

Introduction to Salesforce DX

Developers are always source-driven people. Salesforce DX (developer experience) enables the developer to work with any externalized source – even incorporating version control. “What is Salesforce DX ? It is an open standard developer experience, letting you build with the tools you love including Git, Selenium, Eclipse, Sublime, and more. Salesforce DX includes an updated Eclipse integrated development environment (IDE) that significantly expands the value of the toolset to developers. However, the development process is source-driven. Moreover DX not only allows them to collaborate with other members of team. Moreover, the environment for a developer never works in perpetuity – something that the developer can simply dispose of, on project completion. It is this combination of the environment and the source code that leads to faster development of mobile apps -something that is a yearned by a developer always. Finally, it is a packaging model that is used to aid in the distribution of changes – across environments.The below figure shows some of the core principles around which modern software delivery is centred around. Let us now find out more on the advantages of Salesforce DX: Advantages of Salesforce DX The advantages of Salesforce DX are: Salesforce DX has a source-driven development process, This allows to test the features with agility and confidence. Salesforce DX helps developers build together in teams. In many ways, it brings together the best of the Force.com and Heroku developer experiences. It’s a new approach that supports team collaboration with a focus on quality, predictability, and an open and standardized development lifecycle on Salesforce. The advantage for this is that it enhances productivity and a faster development – thereby decreasing the time to market the product or service. A core theme of Salesforce DX is letting developers choose the tools they want. For example, we’re investing in making the Force.com IDE a best-in-class solution, but with Salesforce DX and our new command-line interface, you can use the text editor or IDE of your choice, along with the CLI, to develop your app. It’s up to you. When it is time to  test your development work, then a Salesforce DX uses a scratch org and pushes the metadata. This scratch org, otherwise known as developer server.- serves only the purpose of testing and validation. There must be automated test runs for each of the change sets for your application. This is named as continuous integration(CI). This is for ensuring quality before any corrupt changes makes it way into the source repository. Following are some of benefits of the scratch org: It is easy to integrate scratch org into a CI process. The scratch orgs are...

Read More
Salesforce™ Health Care Domain Project | API Integration with Dr. Chrono API
Aug24

Salesforce™ Health Care Domain Project | API Integration with Dr. Chrono API

I have worked on many API integrations of Salesforce to other 3rd parties and here I will be sharing my coding experience with Salesforce to Dr.Chrono API integration. One my end clients requested this plugin/ app to be created in Salesforce which will do the Doctors, Patients and other information syncs between the two platforms. Below image shows “integration mind mapping” used by me. I use it to consider some major aspects while discussing integration approaches for this project. In this post, we will discuss how Dr. Chrono API can be used to integrate Salesforce™ with Salesforce™. But before moving forward let’s discuss the requirement of the project.   Data flow diagram https://docs.google.com/drawings/d/1U5MTgnjEuMOwcsGSX1tuRS6dUlZCWd-d6OPxDS9APbw/edit   App development strategy: https://docs.google.com/drawings/d/1jSAsd0TIVH6pY69Sj35t5N8s9Q3_OMZ2LueejZ-Lk_Q/edit?usp=sharing   The project requirements encurtails following. We have to integrate the dr. chrono API with Salesforce™ and create a plugin exclusively, it is a free Healthcare API and SDK built by developers, for developers. Leverage health data, an EHR, practice management and medical billing platform, beside it Dr.Chrono gets 22 Million API calls per month.   What is Dr. Chrono API? A company that helps people find quality care providers nearby, is using the Dr.Chrono API to integrate patient records into the service. This vastly improves the search experience, as patients are connected with doctors based on their medical history and set of conditions. There API uses  common web-based authentication system. It provides a straightforward way for a provider to grant access to their data to your application.   There are three main steps in the OAuth 2.0 authentication workflow. Redirect the provider to the authorization page. The provider authorizes your application and is redirected back to your web application. Your application exchanges the authorization_code that came with the redirect into a pair of access_token and refresh_token. Step 1: Redirect to Dr. Chrono The first step is redirecting your user to Dr.Chrono, typically with a button labeled “Connect to Dr.Chrono” or “Login with Dr. Chrono”. This is just a link that takes your user to the following URL: https://Dr.Chrono.com/o/authorize/?redirect_uri=REDIRECT_URI_ENCODED&response_type=code&Dr.Chrono_id=Dr.Chrono_ID_ENCODED&scope=SCOPES_ENCODED   Step 2: Token exchange Below code is used to obtain a pair of access token and refresh token like this:   import datetime, pytz, requests if ‘error’ in get_params:    raise ValueError(‘Error authorizing application: %s’ % get_params[error]) response = requests.post(‘https://drchrono.com/o/token/’, data={    ‘code’: get_params[‘code’],    ‘grant_type’: ‘authorization_code’,    ‘redirect_uri’: ‘REDIRECT_URI’,    ‘Dr.Chrono_id’: ‘Dr.Chrono_ID’,    ‘Dr.Chrono_secret’: ‘Dr.Chrono_SECRET’, }) response.raise_for_status() data = response.json() # Save these in your database associated with the user access_token = data[‘access_token’] refresh_token = data[‘refresh_token’] expires_timestamp = datetime.datetime.now(pytz.utc) + datetime.timedelta(seconds=data[‘expires_in’])   Roadblock (1): Refreshing an access token Access tokens only last 10 hours (given in seconds in the ‘expires_in’ key in the token exchange step...

Read More
Salesforce Google Map Integration
Sep02

Salesforce Google Map Integration

Google Map Integration Integrating google maps into Salesforce                         Description of the requirement: Starting with description of the Project we have worked upon, there’s an app we created for searching and showing Account’s location on the Map and knowing a route map from one location to another location via some locations(Checkpoints).                            Solution we came with: For the requirement we used Google maps api which is in Javascript format. There are some predefined javascript functions used in the Google map api. We used Google Maps library whoz source is coming from a link i.e., “https://maps.google.com/maps/api/”.                                 There are several Javascript functions we used here which are as follows: Function to get the current location of the User by using the browser’s location. Get the current location of the User by using the browser’s location:                  var geocoder;            var map;            function initialize(){                geocoder = new google.maps.Geocoder();                    console.log(lon+’***latlon–‘+lat );                var latlng = new google.maps.LatLng(lat, lon);                console.log(‘***latlon–‘+latlng);                var myOptions = {                  zoom: 12,                  center: latlng,                  mapTypeId: ‘roadmap’ /* ,                  mapTypeId: google.maps.MapTypeId.TERRAIN */                }                                         map = new google.maps.Map(document.getElementById(“map”), myOptions);   Here we used “google.maps.Geocoder();” to access Google Maps API geocoding service.    We created an apex class method which will take Address of the Account as a string and will return a Geolocation for that address i.e., in Latitude and longitude of the string  address passed in the function as a parameter to it.   Suppose a string will be as shown below: public Account accObj{get;set;} // This is a getter setter method contains Account record. String address = accObj.BillingStreet+accObj.BillingCity+accObj.BillingPostalCode+accObj.BillingCountry;   Now we used the below method to get the Latitude & Longitude: Get the Latitude & Longitude: public static String getLatitudeLongitude(String address){        String location=”;         try{                Double latitude = null;                Double longitude = null;                            Http httpGetRequest = new Http();                HttpRequest httpReq = new HttpRequest();                system.debug(‘******Address—‘+address);                address=address.replaceAll(‘ ‘,’+’);                address = address.replace(‘\r\n’, ‘ ‘);                        address = address.replace(‘\n’, ‘ ‘);                        address = address.replace(‘\r’, ‘ ‘);                        system.debug(‘******After       Address—‘+address);       httpReq.setEndpoint(‘https://maps.googleapis.com/maps/api/geocode/json?key=’+key+’&address=’ +address + ‘&sensor=false’);                                                                                            //Authentication to google api            httpReq.setMethod(‘GET’);            httpReq.setTimeout(6000);            HttpResponse httpResponseAddress = httpGetRequest.send(httpReq);                system.debug(‘res body: ‘ + httpResponseAddress.getBody());                JSONParser parser = JSON.createParser(httpResponseAddress.getBody());                                    while...

Read More
Learning Salesforce in India
Aug01

Learning Salesforce in India

Its a casual day and some newbie in Salesforce asked me “Is Learning Salesforce in India worth”. Mine and everyone’s first answer would be “Do you have the budget to either fly to a western country or pay USD 2000 fees of Salesforce Training online?” Well that is not the cross question what I replied back with. I thought of giving an elaborative answer and wrote this blog. Here are few points I believe “Why Learning Salesforce in India is worth” Young India: We have 1000s of Salesforce enthusiast every year joining in the Salesforce community and 100s of Salesforce Experts in India. With Salesforce everyone is trying to show off and learn as much as possible. This thinking process of an Indian helps other to jump into the competition. With competition one either fails and learns or succeeded and teach others. Salesforce Community: I can see at least 40+ Salesforce Users and Developers group in India and several new groups coming up every day. In past 2 years there is an almost 300% rise in number of registered groups in India. These communities can definitely help you with learning Salesforce and several Recruiters target for bright minds in these groups. Salesforce in India: Salesforce is taking interest. With new announcements from Salesforce investing in hiring Developers and Experts in India it gives a better opportunity for every newbie/fresher. Thus a reason to Learn Salesforce in India is prominent. I believe in No Pain No Gain. To learn anything you should not expect spoonfeeding instead you should be brave and intelligent enough to go out and search for knowledge. The entire social media, youtube, blogs, trail heads, Quora is filled up with information and learning material. www.ajaydubedi.com Startups Hire Freshers: Several Companies startups like mine(www.cloudanalogy.com) are trying to hire freshers and train them in Salesforce. These companies give awesome opportunity to newbies and experienced upto a certain level to get trained and be productive in Salesforce. Salesforce Consultants and Admins: People who are not from a coding background but good at other areas like communication, consulting Testing, Problem solving and also be part of salesforce. Majority of Salesforce business runs around Admins and Consultants Read my blogs regularly to know about the 7th most important reason.www.ajaydubedi.com   I would request everyone reading this blog to share their experience with different Training institutes in India. Name of Institute, Fees, Time duration and Quality of Training. Submit this detail in the comments and win the following Salesforce development...

Read More
Difference SLDS & Aura Components
Apr16

Difference SLDS & Aura Components

As we all know Lightning has been added to Salesforce very recently and it is the future of Salesforce. So lot of people who are new to Lightning but have the curiosity to learn it sometimes find it difficult to understand. I realised that the best way to start would be by describing what are the differences between Salesforce Lightning Design System and Salesforce Lightning Components Framework. So in this blog I will try to explain what are the major differences between Salesforce Lightning Design System and Salesforce Lightning Components Framework and hopefully it will clear out most of the doubts that a new developer is having regarding The Lightning Framework. Introduction to Salesforce Lightning Design System It is a css framework which is used for creating dynamic web apps.   By Using SLDS  We can make our apps responsive and can also provide  Look and feel  similar to the Lightning Experience. Steps to install the SLDS Unmanaged Packaged:For using SLDS in our Salesforce org. First We need to install the Latest Salesforce Lightning Design System unmanaged packaged as a static resource zip file.   Log into your Developer Org. Open the Salesforce Lightning Design System in a Separate window. Go to the Download Section. Click on the latest unmanaged package Now click on Install it. After Completing the above steps the package will get installed into your org.    Benefits of using Salesforce Lightning Design System: By using SLDS it’s easier to build apps which are responsive and also have the look and feel similar to Lightning Experience. It is compatible with multiple browsers like  Google Chrome, Latest Mozilla Firefox,   Latest  Safari Latest Internet Explorer 11 and above . It provides a robust grid system because of which It is easier to build responsive layouts that works elegantly across different screen sizes. The CSS is fully namespaced with the slds- prefix to avoid CSS conflicts. Introduction To Lightning Components Framework  It is built using Open Source Aura Framework. By Using Aura Framework We can build apps completely independent of the Data present in our Salesforce org. Benefits Of Lightning Components Framework : It provides an out-of-the-box set of components for building apps When we use Lightning Components  Framework We do not need to worry about the optimization of our apps for different devices as  Components take care of that by themselves. It uses the stateful client and stateless server architecture which uses  Javascript on client side for managing UI component metadata and Application data. It uses event Driven architecture which  enhances the decoupling  Between components. It supports the latest  browser technology such as HTML5,CSS3. Use Of Developer Console:The Developer Console provide us the tools which are Used...

Read More