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
Day 3 Assignment
Dec28

Day 3 Assignment

I have created 5 days Salesforce based assignment this is third 3rd day I hope you have already finished 1st and 2nd day. If not it is highly recommended to finish the blog-1, and blog-2 part 1 & part 2  first. The assignment is in format of a typical Salesforce requirement, comparable to a small size project. Please go through the requirements which are well defined and should be easily understood if you have a basic understanding of Salesforce sales and service cloud. Your data model design or solution approach to the requirements might be different from the answers provided here. Every solution is correct if you are fulfilling all the requirements. Requirement: We have a university “St Judes” which wants its salesforce account to get configured by us. Following are the requirement of this client.   1. Since Student and Course are having a many to many relationship, the Junction object will have several fields representing the Student’s performance in those Courses. A Student will have the Status of PASS or FAIL and MARKS OBTAINED for each of its Course as well. Click here to learn more For this solution make a picklist having name Status and values PASS or FAIL and a number field named Marks Obtained in the junction object this will do the trick.   2. All the Professor will get an email 2 days before the Course completion asking the Professors to provide marks to those Students in its Course. Click here to learn more For this what i have done is first create a email field in in Professor and Course object and made the email field mandatory. Than I have created a trigger on Course to auto update the email field in the Course object with Professors email. I hope you have done part-1 and part-2 already and you have already created a trigger on course the best practices tells us that we should not make more than one trigger on a single object. So update this part also in your trigger and this part will auto update the email field in Course object with the email field in Professor.   Trigger: Map<Id, Course__c> profCourseMap = new Map<Id, Course__c>(); List<Course__c> fullCourseList = [SELECT Id, Name, Professor_del__c, Professor_Email__c FROM Course__c WHERE Id IN: Trigger.newMap.keySet()]; for (Course__c course : fullCourseList) { if (Trigger.isInsert) { profCourseMap.put(course.Professor_del__c, course); } if (Trigger.isUpdate && Trigger.oldMap.get(course.Id).Professor_del__c != course.Professor_del__c && course.Professor_del__c != NULL) { profCourseMap.put(course.Professor_del__c, course); } } System.debug(‘profCourseMap————–‘ + profCourseMap); System.debug(‘profCourseMap————–‘ + profCourseMap); List<Course__c> listToBeUpdated = new List<Course__c>(); List<Professor__c> mainProfList = [SELECT Name, Email__c FROM Professor__c WHERE Id IN: profCourseMap.keySet()]; for (Course__c course : profCourseMap.values()) { for (Integer i = 0;...

Read More
Day 2 Assignment Part-1
Dec08

Day 2 Assignment Part-1

I have created a 5 Days Salesforce based programming and configuration assignments for practice and improving your skills. This blog have the second day assignment. The assignment is in format of a typical salesforce requirement, comparable to a small size project. To design and develop this project it is recommended that you register a fresh salesforce developer org. Please go through the requirements which are well defined and should be easily understood if you have a basic understanding of salesforce sales and service cloud. You data model design or solution approach to the requirements might be different from the answers provided here. Every solution is correct if you are fulfilling all the requirements. Requirement: We have a university “St Judes” which wants its salesforce account to get configured by us. Following are the requirement of this client.   1.1. A Student can register to multiple courses and A Class can have multiple Courses and each Course can have multiple Students. Hint: It can easily be done by simple Datamodel configuration. For this you have to create some custom objects like University, Class, Student, Course, etc. Click here to learn more For creating custom object the procedure is like: Go to setup, click on the search bar and type objects or go to setup, then go to Create than select objects   than create the required objects. Here is one example of creating a custom object:   Than click on new button you’ll able to see the page shown below. After creating all the required objects you do need to create a flow diagram or Datamodel for further implementation. Here is one with which i have created you can design it in your style and in your own way. For more information on master-detail realtionship and junction object please follow the Link. Junction Object For creating field in your dev org you have to follow these steps: Go to setup>search objects than click on the the custom object in which you want to create the field. Let us go to Course object which you must have created by following the datamodel. Now when we go to our object we will find custom field and relationship extention there now click on the new button. Now select the type of field which you want to create what we are going to do is to create a lookup field in Course object. Than you will get a page to select a related to object in which you have to pick your related object in it like i have picked professor as my related to object. now click next button than write a name and...

Read More