Author Archives: SAGAR PAREEK

2018 to end with more success stories

You must have read my previous blog posts where i mentioned how 4 students from poor family backgrounds were able to become Salesforce Developers with the help of our user group (Bikaner, IN Developers Group) https://trailblazercommunitygroups.com/bikaner-in-developers-group/ . That was 2017 and after that I was busy helping another batch of trailblazers in my user group.
In the continuation of this giving back to community or what we call now days BAM ( BE A MULTIPLIER) I am feeling really proud to announce the names of students who were able to launch their careers as Salesforce Developers in 2018. This year too we followed the same pattern of developing salesforce development skills using trailhead and communication skills using the meetups sessions where students used to present their sessions additionally in our daily learning sessions we used to go with news websites to enhance the pronunciations.

Here are the names –

1. Ashok Patel (https://www.facebook.com/ashokpateljodhpur)

He is basically from a family of Village Doli th.-Luni District Jodhpur, Rajasthan

Now he is working at KVP Business Solutions,Bangalore as Salesforce Developer.

2. Sandeep Kumar Yadav (https://www.facebook.com/profile.php?id=100009205719592)

He is basically from Village – Fatehpura Kalan, Kotputli, Rajasthan. His father runs a dairy shop.

Now he is working at ForecastEra LLP, Hyderabad as Associate Salesforce Developer.

3. Rijwan Mohmmed (https://www.facebook.com/rijwan.mohmmed)

He is basically from Ajmer, Rajasthan

Now he is working at Kcloud Technologies, Faridabad

4. Manish Mourya (https://www.facebook.com/manish.mourya.7374)

He is basically from Jodhpur, Rajasthan from a middle class family. His father works for Indian Railways.

He is now working in AppScrip, Bengaluru as Salesforce Developer.

With new year coming up ( I know its too early to say this) I will be looking out for more students to mentor in 2019. Don’t forget to say ‘Hi’ in the next user group meetup in Bikaner 🙂

How a son of a farmer became a salesforce developer using limited resources

You might have read my previous post How a Salesforce user group changed life of these 3 students this post was about 3 students who regularly attended student user group meetup.
Today I am writing this blog post about a student who showed up in our meetups and worked hard to became a salesforce developer by self study.

Today I am introducing Rinku Saini student of Government Engineering college Bikaner.

Rinku met me in our August 2016 meetup since then he was doing some of salesforce configuration side stuff but was not good at apex code. Rinku used to stay in touch via phone or emails and used to ask questions on weekly basis as he was not able to access internet regularly and cannot afford a mobile phone or hotspot. Thanks to his college’s wifi access he was able to study salesforce after college hours.

He also tried to openly discuss about apex triggers in our August meetup last year –

After reading my previous post he called me yesterday to tell that he has also got job and thanked me about giving him chance to present him at student meetup, time, workbooks and books which i gave him to do self study.

Rinku belongs to Dausa in Rajashtan State of India. His father is farmer. Rinku has economical pressure on his shoulders to get job soon after completing his studies.
His dedication and hard work is inspiring. He has proven that successful people make out from what ever resources they have. Rinku now works at Wakencode Technologies Private Limited in New Delhi India.

I wish Rinku good luck for his future. And would like to thank Salesforce Developer Relation team who constantly supported us.

How a Salesforce user group changed life of these 3 students

You all are aware how I started Bikaner Salesforce Students Group ( formerly known as India Students Salesforce Developer User Group), which was the first Student’s user group in India and my main source of self study which made me self tech myself salesforce and then helped others do the same.

This all started in 2012 after attending the India tour and then this group changed my life which included landing my first job offer and then writing my two books on salesforce and the success continued and you might have seen my success story in this TED talk -> Life’s New Syllabus . Since then I have been organizing meetups from 2012.

Bikaner is north western India’s small town where we used to get 5,10 or sometimes 20 students attending our meetup from 5 different Engineering colleges in the area.

Since 2012 I met variety of students and few salesforce professionals in this user group’s meetups. Every year mostly 1 or 2 students used to stay touch with me and get help and passed out certifications and landed jobs in near by areas mainly Jaipur.

But this year was great! This year 3 students made out to become salesforce developer and this was not possible without help of Salesforce.com Developer Relations Team.

One year back three students came to me asking for help to learn Salesforce just after attending our June 2016 Meetup. These all seemed to me very excited to learn this new tech but they had some constraints –

1. Poor knowledge of English as a Language ( as they all were from Hindi medium schools).
2. Poor financial background ( they all were from remote towns of Rajasthan state and had educational loan on them to pay off).
3. Pressure of getting a job ( since they were doing engineering studies on loan it was essential for them to get job right after the college is over ).
4. Communication Skills.

Looking at their excitement and question they were asking about Salesforce.com I decided to ask them for commitment to attend each meetup I organized thereafter and a 40 minutes morning google hangout every weekday. It was time of emerging 4G internet in India and luckly they got free internet access. They used to gather at one place and use one hotspot which they bought by each other’s help.

This is what we started doing in daily google hangouts at 7 AM –

1. Reading an english newspaper daily and coming out with new words they discover each day for the first 20 minutes of the call.
2. Salesforce topics dicussion and learning.
3. Assignment for the next day.

We continued the above pattern for first 3 months and then introduced trailhead at the place of assignments.

For the very first weeks everything seemed to be impossible as english was really really bad. But soon after 3 months things started working. They were doing great on the configuration side.

With each meetup they used to present and teach other students and their confidence started building up.

Photos from July and August 2016 meetup –

Soon after 6 months they were doing some basic visualforce and apex this was something they never thought.

Days passed and they now started giving presentation in their college and this was something taking them away from other students ( they out of the crowd of ordinary students).

Last year the college placement was low and it was a strong prediction for current year too, they were afraid of not getting job this year but I asked them to focus on what we are doing in assignments and trailhead.

Look at the photos soon after one year they were teaching other in the same User Group meeting –

And now I am proud to announce that all 3 students got job. This was not possible without their hardwork and dedication.

Here are some details of these students-

1. Surendra Bishnoi from Bhinmal,Rajasthan, India got job in VersatileCapitalist Software Inc. – Jaipur, India
2. Omprakash Saini from Jhunjhunu, Rajasthan, India got job in Kcloud Technologies – Faridabad, India
3. Yogeshwar Tailor from Sikar, Rajasthan got job in C Centric Solutions Pvt. Ltd. – Bengaluru, India

This year I plan to help atleast 3 more students to develop their career on top of Salesforce.com

I would really like to thank Salesforce.com Developer Relation Team which always helped us.

Lightning: $A

$A is known as the Aura object. Aura object is top level object in javaScript framework code.

Usage of $A

// Find a component where you wan to apply the util
var myAttr = component.find("myAttr"); 
$A.util.addClass(myAttr, "add-class");

Can be used with –

getBooleanValue
hasClass
isArray
isEmpty
isObject
isUndefined
isUndefinedOrNull
removeClass
toggleClass

More reference can be found on – https://na15.lightning.force.com/auradocs/reference.app

Lightning: Action Handlers

Action handlers are just JavaScript functions with a particular function signature.

Action handlers are also known as –
1. controller action
2. controller function

Declaring an Action Handler –

For example you have Action Handler named handleClick

handleClick: function(component, event, helper)

3 parameters that are part of this Action Handler are –

1. component – The component which called this Action Handler.
2. event – The event which caused this Action Handler to be called.
3. helper – the component’s helper, another JavaScript resource of reusable functions.

JDF 17 Session Resources: Publishing your app on appexchange.

Resource Page for Jaipur Developer Festival session Publishing your app on Appexchange

Link to slide deck Publishing your app on Appexchange – Sagar Pareek

1. Storing Secrets –

What is it? : Sensitive data is exposed to user.
Remedy: Use protected custom settings.

Create custom settings with private as visibility.
Name it App Custom Settings.
Make sure setting type is List.

Create a custom object named Integration Setting
Name field should be of Auto Number ( I-{00000} )
Create 3 custom fields
Username
Password
Endpoint URL

Trigger Code –

/* Created By: Sagar Pareek
   Description: This trigger replaces the password with asteriks and saves the password in protected custom settings mapped with username.

*/

trigger IntegrationSettings on Integration_Settings__c (before insert, before update) {
    if (trigger.isBefore){
     //  Map to be checked against for the existence of a Custom Setting for a User
     map userToCustomSetting = new map();
      
     //  Lists for new, updated, and existing settings.
     list newSettings = new list();
     list updateSettings = new list();
     list existingSettings = [SELECT  Id, Name, Password__c FROM   App_Custom_Settings__c ORDER BY  CreatedDate LIMIT   25];  
        
     list validApplicationSettings = new list();
         
        //  Populate the map based on the above query's results - keyed by the Username (name contains username)               
     if (!existingSettings.isEmpty()){
      for (App_Custom_Settings__c s : existingSettings){
       userToCustomSetting.put(s.Name,s);
      } 
     }
      
        for (Integration_Settings__c  stg : trigger.new){
            if (stg.Password__c != null && stg.Password__c  != '' ){
             //  Inserts are easier - as long as the Password was provided, we'll add it
                if (trigger.isInsert)
              validApplicationSettings.add(stg);
             //  We'll make sure the old and new Password values don't match and aren't udpated to the "masked" value
                else if (trigger.isUpdate)
              if (stg.Password__c != '********' && stg.Password__c != trigger.oldMap.get(stg.id).Password__c)
                  validApplicationSettings.add(stg);
            }
        }
         
        if (!validApplicationSettings.isEmpty()){
            for (Integration_Settings__c  stg : validApplicationSettings){
                //  Do any Custom Settings exist for this User?  If so, update.  Otherwise, create.
                if (userToCustomSetting.containsKey(stg.Username__c)){
                    userToCustomSetting.get(stg.Username__c).Password__c = stg.Password__c;
                    updateSettings.add(userToCustomSetting.get(stg.Username__c));
                }
                else{
                    newSettings.add(new App_Custom_Settings__c(Name = stg.Username__c, Password__c = stg.Password__c));
                }
                //  Replace the Password
                stg.Password__c = '********';
            }
           
            //  Do inserts and updates
            if (!newSettings.isEmpty())
                insert newSettings;
            if (!updateSettings.isEmpty())
                update userToCustomSetting.values();
        }
    }
}


Security Scanner Link

Force.com Security Scan Report

Link to force.com security scan report

ZAP tutorial

Sample ZAP Report

ZAP Report Link

Reporting False Positives in ZAP report

Link to False positive documentation

On Passing your review –

Screen Shot 2017-03-29 at 1.57.43 PM

Plot your customers using Geocodes for Addresses

Introduction
With summer’ 16 release salesforce introduced a new feature Geocodes for Addresses which enables users to get geocodes added for addresses on existing and new accounts, contacts, and leads.

How is it useful for my organization ?
A. This can help your organization’s salesforce users/ sales reps to identify prospects in a particular area.
B. This can help to set up campaigns based on location.
C. This can your business to assign leads or opportunity to your sales reps.
D. You can identify distance between you and your customer locations.

How it can be used?
Currently this feature is rolled out to following standard address fields ->
A.Billing and Shipping Address Fields on Accounts object.
B.Address Field on Leads object.
C.Mailing Address Field on Contacts Field.

How does it works?
Its works with no extra efforts. You just need to supply the address information in supported address fields and geocodes are automatically generated for the particular record.

The clause is you should have Geocode Clean Rules activated. Once activated salesforce generates the address coordinates on the existing records and new records in supported objects

What can be an example for this?
Let say you enter Amsterdam, Netherlands as Billing Address on an account record.
Now salesforce will generate following values in the geocode fields
BillingLadtitude -> 52.37317
BillingLongitude -> 4.89066

Note that these fields act as part of BillingAddress field a.k.a Address Compound Fields

How I can verify the values are correct?
You can use http://www.latlong.net/Show-Latitude-Longitude.html

What can be a business use case?
Lets say you want to plot your customers (Accounts) on a graph based upon the distance between your organization’s HQ and customer location based on Billing Address.

How it can be done?
We can do it using visualforce and apex. I will explain this using my previous post Simple dashboard using Bootstrap + Chart.js inside Salesforce.com

Using the same I have plotted Number of customers v/s distance graph

I have created buckets of distance in form of –
A. Less than 50 Miles.
B. Between 50 and 100 Miles.
C. Between 100 and 150 Miles.
D. More than 150 Miles.

The location from which I am calculating the distance is Gurgaon,Haryana,India which equals to location coordinates as Longitutde -> 28.4247649 Latitude -> 76.8496956

How it is possible in code?

For calculating the distance we are using the Location Based SOQL Query and Geocode for Address Fields

The query looks like ->
SELECT id,name FROM Account where DISTANCE(BillingAddress, GEOLOCATION(28.4247649, 76.8496956), 'mi')<50

The DISTANCE is being used to calculate the difference between the BillingAddress Coordinates and Gurgaon's coordinates, mi denotes the unit of measurement is Miles, it can be changed with Kilometers(km).

Where is the code?

Here you go ->

Visualforce Page ->


    
    
        
            Charts
            
            
            
            
        
      
          
         

Apex Class ->

public class GeoChartCreatorCls {
    public List accList;
    public Integer lessThan50 {get;set;}
    public Integer range50To100 {get;set;}
    public Integer range100To150 {get;set;}  
    public Integer moreThan150 {get;set;}
    public geoChartCreatorCls(){
        accList = new List();
        lessThan50 = 0;
        range50To100 = 0;
        range100To150 = 0;
        
              
        generateData();
        
    
    }
    
    
   
   public void generateData(){
   
       accList  = [SELECT id,name FROM Account where DISTANCE(BillingAddress, GEOLOCATION(28.4247649, 76.8496956), 'mi')<50];
       
       if(accList!=null && accList.size()>0){
           lessThan50 = accList.size();
       }
       
       accList  = [SELECT id,name FROM Account where DISTANCE(BillingAddress, GEOLOCATION(28.4247649, 76.8496956), 'mi')>50 AND DISTANCE(BillingAddress, GEOLOCATION(28.4247649, 76.8496956), 'mi')<100];
       
       if(accList!=null && accList.size()>0){
           range50To100 = accList.size();
       }
          
       
       accList  = [SELECT id,name FROM Account where DISTANCE(BillingAddress, GEOLOCATION(28.4247649, 76.8496956), 'mi')>100 AND DISTANCE(BillingAddress, GEOLOCATION(28.4247649, 76.8496956), 'mi')<150];
       
       if(accList!=null && accList.size()>0){
           range50To100 = accList.size();
       }
           
       
       accList  = [SELECT id,name FROM Account where DISTANCE(BillingAddress, GEOLOCATION(28.4247649, 76.8496956), 'mi')>150 ];
       
       if(accList!=null && accList.size()>0){
           range50To100 = accList.size();
       }
       
       
   }

}

Do geocode fields works with Person Accounts?
No.

Any issue encountered while working with this?
The only issue I found while working with DISTANCE is, it wont supports = [equals to],>= [greater than equals to] and <= [less than equals to]

Trailhead : Apex Integration Services

Are you looking to learn Salesforce Integration? Yes all about that thing which integrates another system with your Salesforce Organization. But you are not aware from where to start?

The Salesforce Trailhead now offers a fun way to learn everything related to Salesforce Integration.

The Trailhead module is named as Apex Integration Services.

This module offers 4 units –

1.Apex Integration Overview
2.Apex REST callouts
3.Apex SOAP callouts
4.Apex webservices

The first unit deals with Overview, walks you thru the main differences between webservices and HTTP callouts and then tells you how you can define a remote site setting so that you can white list the end points of the service you are about to use for integration.

The second unit is about REST callouts, walks you thru the basics of REST callouts then tells you how you can send data and receive data from a service. Lastly you learn about writing test class for callout class you wrote in during this unit.

The third unit is about SOAP callouts, walks you thru the process of generating Apex classes using WSDL and then using them how you can send and receive data. And lastly you learn about writing test classes as you did in last unit.

The fourth and last unit is about the Apex webservices, this unit first gives you high level overview of what Apex webservices are then tells you how you can expose your salesforce Apex classes as SOAP and REST service including different methods you can offer. Lastly it ends with the test classes for the webservice classes you wrote during this unit.

Ahha! It wasn’t so much easy when I started learning Apex Integration but now you can So go ahead, learn and tryout Apex Integration Services