Thursday 17 December 2015

Bootstrap Modal Using AngularJS and Javascript in #Salesforce

This blog is about using bootstrap modal using AngularJS and Javascript, there are two different ways of using the modal and fetching the values from the modal.

I have added few fields in the modal and accessing the fields from the modal using two different buttons, below are the buttons

Modals code is same but only the function of fetching the values is different.
Here is how the modal looks


Here is the code of the page with the modal code and accessing the values of the modal in different ways.
Check out the code and if any issue or queries just comment I would be happy to help.

1:  <apex:page sidebar="false" showHeader="false" docType="html-5.0" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="false">  
2:    <html lang="en">  
3:      <title>Manage Users</title>  
4:      <head>  
5:        <meta charset="utf-8"></meta>  
6:        <meta name="viewport" content="width=device-width, initial-scale=1"></meta>  
7:        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"></link>  
8:        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>  
9:        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>  
10:        <script>  
11:          $(document).on("click","#myReset",function() {  
12:            $('#myModal').modal('hide');  
13:          });  
14:          //click to save data filled in the modal using javascript  
15:          $(document).on("click", "#btnCreateContact", function(event){  
16:            var fn = document.getElementById("firstname").value;  
17:            var ln = document.getElementById("lastname").value;  
18:            var ph = document.getElementById("phone").value;  
19:            var em = document.getElementById("email").value;  
20:            var title = document.getElementById("title").value;  
21:            if(em == '' || ln == '' || fn == '' || title == '') {  
22:              alert('First Name, Last Name, Email and Title are required.');  
23:            } else {  
24:              //calling remote action  
25:              YOUR_APEX_CLASS.REMOTE_ACTION_METHOD(fn, ln, em, title, ph, function(response,event) {   
26:                $('#myModal').modal('hide');    
27:                if (event.status) {  
28:                  //debugger;   
29:                  if (response == null || response == '') {  
30:                    //Reload window and close modal  
31:                    //window.location.assign(window.location.href);  
32:                    window.location.reload(true);  
33:                    $('#myModal').modal('hide');  
34:                  } else {  
35:                    $('#myModal').modal('hide');  
36:                    alert(response);  
37:                    window.location.reload(true);  
38:                  }  
39:                } else {  
40:                  $('#myModal').modal('hide');  
41:                  alert(event.message);  
42:                  window.location.reload(true);  
43:                }  
44:              },{escape:false, buffer: false});  
45:            }  
46:          });  
47:          // USING ANGULAR NOW  
48:          //Initialling controller  
49:          myapp.controller('MainController',['$q','$log','$scope',function($q,$log,$scope){  
50:            $scope.firstname = '';  
51:            $scope.lastname = '';  
52:            $scope.phone = '';  
53:            $scope.email = '';  
54:            $scope.title = '';  
55:            //CALL REMOTE ACTION METHOD   
56:            MY_CLASS_NAME.REMOTE_ACTION(firstname, lastname, phone, email, title, function(response,event) {   
57:              // DO YOUR STUFF HERE  
58:            });  
59:          }]);  
60:         </script>  
61:      </head>  
62:       <!-- Modal -->  
63:       <div class="modal fade" id="myModal">  
64:        <div class="modal-dialog">  
65:         <!-- Modal content-->  
66:         <div class="modal-content">  
67:          <div class="modal-header">  
68:           <button type="button" class="close" data-dismiss="modal">&times;</button>  
69:           <h4 class="modal-title">Contact Details</h4>  
70:          </div>  
71:            <div class="col-xs-12 form-group">  
72:            </div>  
73:            <div class="col-xs-12 form-group">  
74:              <label>First Name<font color="red">*</font></label>  
75:              <input class="form-control" id="firstname" value="" ng-model="firstname"/>  
76:            </div>  
77:            <div class="col-xs-12 form-group">  
78:              <label>Last Name<font color="red">*</font></label>  
79:              <input class="form-control" id="lastname" value="" ng-model="lastname"/>  
80:            </div>  
81:            <div class="col-xs-12 form-group">  
82:              <label>Email<font color="red">*</font></label>  
83:              <input class="form-control" id="email" value="" ng-model="email"/>  
84:            </div>  
85:            <div class="col-xs-12 form-group">  
86:              <label>Title<font color="red">*</font></label>  
87:              <input class="form-control" id="title" value="" ng-model="title"/>  
88:            </div>  
89:            <div class="col-xs-12 form-group">  
90:              <label>Phone</label>  
91:              <input class="form-control phone" id="phone" onchange="formatPhone(this);" ng-model="phone"/>  
92:            </div>  
93:            <div class="btn-group" align="center">  
94:              <button id="btnCreateContact" class="btn btn-primary btn-md center-block" style="margin-left: 216px;">Save</button>  
95:              <a href="#" id="myReset" class="btn btn-primary btn-md center-block" style="margin-left: 15px;">Cancel</a>  
96:            </div>  
97:            <br></br>  
98:            <br></br>  
99:            <div class="modal-footer">  
100:            </div>  
101:           </div>  
102:         <br></br>  
103:       </div>  
104:       <br></br>  
105:      </div>  
106:      <br></br>  
107:      <div >  
108:       <div class="container">  
109:         <div class="panel panel-default">  
110:           <br></br>  
111:           <div class="btn-group" align="center" style="left: 27%;">   
112:             <button id="blocds" data-toggle="modal" data-target="#myModal" class="btn btn-primary btn-md center-block" style="margin-left: 15px;">Modal Using Javascript</button>   
113:             <button id="blocds" data-toggle="modal" data-target="#myModal" class="btn btn-primary btn-md center-block" style="margin-left: 15px;background-color:#DF4720">Modal Using AngularJS</button>   
114:           </div>  
115:           <br></br>  
116:           <br></br>     
117:         </div>  
118:       </div>  
119:      </div>   
120:    </html>   
121:  </apex:page>  

Happy coding!!

Monday 2 November 2015

FIND MY PARENT SALESFORCE USERS BY ROLE HIERARCHY

Was looking into a blog post of jeff douglas on FIND MY SALESFORCE USERS BY ROLE HIERARCHY, its an awesome utility code for fetching the child users in the hierarchy, so thought of righting a same kind of code to get all the parent users in current user's hierarchy, when I started writing it then I realized it is not that much easily, have to give some time to it.

So here I am, below is the code for fetching the Parent user's id in hierarchy, the method will the return a map of user on the key and the set of Id's of the parent user in the values.


1:public static Map<Id, Set<Id>> getRoleParentSubordinateUsers(Set<Id> userId) {  
2:      Map<Id, Id> roleIds = new Map<Id, Id>();  
3:      Map<Id, Set<Id>> parentRoleIds = new Map<Id, Set<Id>>();  
4:      // get requested user's role  
5:      for(User usr : [select Id, UserRoleId from User where Id IN: userId and UserRoleId != null]) {  
6:        roleIds.put(usr.UserRoleId, usr.Id);  
7:      }  
8:      Map<Id, Set<Id>> parentids = new Map<Id, Set<Id>>();  
9:      for(Id ids : roleIds.keySet()) {  
10:        parentRoleIds.put(ids, getAllParentRoleIds(new Set<ID>{ids}));  
11:      }  
12:      for(Id kys : parentRoleIds.keySet()) {  
13:        for(Id ids : parentRoleIds.get(kys)) {  
14:          if(!parentids.containsKey(ids)) {  
15:            parentids.put(ids, new Set<Id>{kys});    
16:          } else {  
17:            parentids.get(ids).add(kys);  
18:          }  
19:        }  
20:      }  
21:      Map<Id, Set<Id>> mapOfCurrentWithParentUsers = new Map<Id, Set<Id>>();  
22:      // get all of the ids for the users in those roles  
23:      for(User us : [Select Id, Name, Region__c, State__c, UserRole.Name, UserRoleId From User where IsActive = true AND (UserRoleId IN: parentids.keySet() OR UserRoleId IN :roleIds.keySet())]){  
24:        for(Id rids : parentRoleIds.keySet()) {  
25:          if(parentids.containsKey(us.UserRoleId)){  
26:            if(parentids.get(us.UserRoleId).contains(rids)) {  
27:              if(!mapOfCurrentWithParentUsers.containsKey(roleIds.get(rids))) {  
28:                mapOfCurrentWithParentUsers.put(roleIds.get(rids), new Set<Id>{us.id});   
29:              } else {  
30:                mapOfCurrentWithParentUsers.get(roleIds.get(rids)).add(us.Id);  
31:              }  
32:            }  
33:          }  
34:        }  
35:      }  
36:      // return the ids as a set so you can do what you want with them  
37:      return mapOfCurrentWithParentUsers;  
38:    }  
39:    private static Set<Id> getAllParentRoleIds(Set<ID> roleIds) {  
40:      Set<ID> mapOfCurrentWithParentRole = new Set<Id>();  
41:      // get all of the roles underneath the passed roles  
42:      for(UserRole userRole :[select Id, ParentRoleID from UserRole where Id IN :roleIds AND ParentRoleID != null])  
43:        mapOfCurrentWithParentRole.add(userRole.ParentRoleID);  
44:       // go fetch some more rolls!  
45:      if(mapOfCurrentWithParentRole.size() > 0){  
46:        mapOfCurrentWithParentRole.addAll(getAllParentRoleIds(mapOfCurrentWithParentRole));  
47:      }  
48:      return mapOfCurrentWithParentRole;  
49:    }  

Happy Coding!!

Friday 16 October 2015

#SALESFORCE PLATFORM APP BUILDER CERTIFICATION : SHARING EXPERIENCE

Few days ago, cleared Salesforce Platform App Builder Certification Transition exam, its my 7th Salesforce Certification, I have DEV401 so for me its was 30 minutes exam, having 20 questions, but if you don't have DEV401 then it will be 60 mutliple choice questions for you for 120 minutes, if you have DEV401 and ADMIN 201 then it will be easy for you to clear the exam. Even though I would recommend to study before appearing in the exam. To know more about the exam click here.

Key topic to cover before appearing in the exam :

1. Field Type change affects ( 1 question )
2. Relationships and their properties ( *Master Detail, lookup ) ( 3 questions )
3. Lightning components (*Global Actions, Object Specific Actions) ( 3 questions )
4. Record Types ( 3 questions )
5. External objects ( 1 question )
6. Types of Sandbox ( 1 question )
7. Unmanaged and Managed Packages ( 1 question )
8. Social Accounts, Contacts and Leads ( 1 question )
9. Salesforce1 ( 1 question )
10. Trailhead ( **Salesforce Practice )

I don't remember the questions, but the above topics are more than enough to clear the exam, please do go through the study guide. Passing percentage is 65% that means at least 14 questions should be correct.

Suggestions :

1. Read the questions carefully and the options, many question were TRUE and FALSE and Multiple answer questions.
2. Don't know the right answer, no worries, search for the wrong one, it will clear off your confusion.
3. Easy exam, but don't take it lightly, prepare yourself then go for it.

All the best.

Thursday 8 October 2015

Reasons Why #Salesforce is the best technology to work with

Many times I felt to share my thoughts for Salesforce and what I feel while working on force.com platform, their are many things in the list and I tried to cover most of them. Might be something got missed because they are allot.


Starting with the best : Connectivity

Salesforce has connected just everything that is working with them or working on Salesforce, salesforce have Partner Programs, in which they help other companies who work on Salesforce, to make it easier for them to do business.

Connects every one with their largest tech-fest DREAMFORCE. This df'15 was also the biggest one. Saleforce helps their customer at everyone point. They work with the society as well, as in this dreamforce they donated 1 Million books to read more click here
There are many things happened at this dreamforce , I got an awesome link to get everything at one place about the dreamforce go to this link, Dreamforce Content Guide



Salesforce hearts : Salesforce MVPs

Salesforce have like 190+ MVP, which are nominated by others, they are the one who utilize there knowledge and experience of salesforce and their work with other to help them learning in Salesforce, this is also a best way
to acknowledge the person who are truly dedicated to their work, few MVPs I know are just awesome and happy to help others, normal example you can have in the communities of Salesofrce they are every where and making Salesforce geeks everyday, they inspire others with their work helping other in learning of the new things of the Salesforce. Salesforce MVP's are truly hero's the way they encourage other, Lauren Jordan is great example of this initiative she encourages the girl power by writing about womens working on the technology by this she inspire others as well (https://saasyforce.wordpress.com/)
And the other one is "Admin Hero" this guy is really a hero, writes about the awesome stories of those guys who have been delicately worked on Salesforce (http://www.adminhero.com/) This blog is by Brent Downey, this is his way of encouragement.


Trailhead : Place to play and learn Salesforce

Trailhead is a place to learn and explore your knowledge with Salesforce platform, it has their Modules and step by step learning tutorial.
This is the year where everybody got to know that how easy is salesforce to learn,
this happened because of the Trailhead, people just started it to learn salesforce and end up becoming a fan of the way they teach you Salesforce, Trailhead is free for everyone, and even kids are learning Salesforce with it. As of now Trailhead has 66 + badges which you will get by completing the modules, the modules of the trailhead covers almost all the part of the Salesforce from Admin to Development to Mobile app to Heroku. Recently they appreciate who all are new to trailheal by sending them an awesome Salesforce t-shirt. If you have still not tried trailhead please go right now and start Trailhead


Salesforce Certifications

Salesforce certifications is a way to show of your expertise in Salesforce, whoever is working on Salesforce have their own madness for the certifications I only know one person who have the maximum no. of Ceritifcations and that is Keir Bowden This is his blog link http://bobbuzzard.blogspot.in/ He is an inspiration, Salesforce have many certifications, each certificate have it definition and defined for a particular expertise. Recently salesforce added few new certifications and Transition exams as well. Companies also looks for the proven expertise which is Salesforce certification, the biggest one is Salesforce Architect (my dream). Become Salesforce Certified Professional and get your dream job.


Salesforce have many more things that will make you crazy to work on Salesforce or get connected with Salesforce, Salesforce in one fastest growing cloud based platform in the world. So come join us.

Thanks

Saturday 3 October 2015

Mobilize small business at its best with #SalesforceIQ

This dreamforce 2015 many new things were introduced by Salesforce and one of the best and new things from the list is SalesforceIQ, at the same time I thought of using it and listing out its features, SalesforceIQ has utilized it well, it was formerly RelateIQ, Salesforce in July 2014 salesforce acquired the company .

Overview

I basically a mobile app for your emails integrated with your Salesforce org, with some extra feature using which you can utilize your Salesforce Leads, Contacts and Opportunities. You can create tasks as well. New SalesforceIQ for Small Business delivers SMBs a smarter and easier way to supercharge sales. SalesforceIQ is for Small Business, the smart, simple CRM to grow your business.
Here is the pricing, for more details about the pricing go to SalesforceIQ



I am just going to give a step by step, small tutorial of SalesforcIQ.

1. Go to the app store download SalesforceIQ app from there, install it in your phone.


2. Configure your email with SalesforceIQ, you can use gmail or outlook as well and then enter you salesforce Credentials.


4. After all the configuration done, you can access your emails with folders as in gmail you have created.


5. On menu SalesforceIQ have as of now 5 options, its continuously updating, by the time you install it can have more.


6. When you will receive an email you can right from that email you can create a Lead or Contact or Opportunity in Salesforce.


This is how a contact created from the mail is shown, on click on right corner check it will create a contact.


7. Feed in SalesforceIQ

8. Creating Task in SalesforcIQ, Click on the Task option from the navigator, click on right corner + button to add a new task, enter the information then click on check on the right corner to save.




9. In the setting option of the navigator, you can create you signature and sync your phones contacts with SalesforceIQ


for sales reps it will be too helpfull, they can utilize salesforceIQ at it best, thats why it is called as made for small business. I guess this is enough as it will keep on updating as it a salesforce product.

Friday 18 September 2015

#Salesforce Certified Advanced Administrator Certification ADM 301 - Sharing Experience

Recently like 10 days ago cleared my first "advanced" certification that is Advanced Admin, I have been preparing for Salesforce certifications but time for not supporting me, when time starts giving the support I cleared 5 Salesforce certifications in 80 days and the last on is this one, as I was in a continuous preparation of Admin ADM201, Sales Cloud and Service cloud certification, the preparation helped me allot for clearing ADM-301.


Preparations before appearing in the exam,

After Service cloud certification, I felt this is also not gonna be easy to clear, and trust me ITS NOT.
The exam has Admin, Sales cloud and Service cloud all mix together and raised with one level questions. So you should have Sales and Service experience must before appearing in the exam. Please go through the study guide to check in brief about the exam.


About the exam :
Cost $200 and retake is $100.
60 multiple-choice/multiple-select questions
Passing score: 65%
Time allotted to complete the exam: 90 minutes


Here is a table from the study that will help you what to look into the most for preparation


Its totally clear that these below points have heavy weight-age in the exam
1. Security and Access
2. Sales Cloud Applications
3. Service Cloud applications
4. Reports & Dashboards
5. Process Automation

Please check once before going to the exam the videos I have shared for the preparation of Sales Cloud and Service Cloud, it will surely help you.

My Recommendations :

Advanced Administrator Certification Guide & Tips By Salesforce Ben

From Administrator To Advanced administrator of Salesforce CRM and Force.com Applications

How To Study For The Salesforce Advanced Admin Exam


All the best !!

Sunday 16 August 2015

Salesforce Certified Service Cloud Consultant Experience

Added one more certification in my list, its one of the known logic based certification, I was nervous when I was giving the certification, you need to have in depth knowledge of Sevice cloud implementation in Salesforce, its all about how a consultant can implement Service cloud at its best in Salesforce.
click here to know more about certification. There are 60 questions on the exam and you need a 68% to pass. Here is the study guide summer'15

I personally recomment these blogs as well

Jeff Douglas Blog (One of my favourites)
How to Study for the Salesforce Service Cloud Consultant Exam

Here is a list of key points to look into before appearing in exam :

1. Knowledge-base technology
2. Email to Case
3. Live Agent
4. Social Contact Centers
5. Milestone & Entitlements
6. Communities
7. Articles
8. Cases (360 degree knowledge)
9. Search Results
10. Service Contract


Other then above you should have Call center knowledge, how to collaborate in between agents and why a consultant should recomment a call center for knowledge and article. Here is a tip sheet that can help.

As I shared a video in Sales Cloud Certification blog, here is the another that will help you in Service Cloud Certification, other then these if you have partner portal access then please do watch Service cloud related videos in it.



You can also go through the flashcard available on cram.com for practice.

If you are done with all these then for sure you are gonna do well in the exam, all the very best.
Thanks

Thursday 13 August 2015

Get Current Geolocation in Salesforce using Geolocation API

Recently was trying to fetch the current location of mine in salesforce, most of the time people use google api's for it, but just dig in a bit and found something way too easy and way too awesome to use, the best part is you can utilize the javascript code without referring any further libraries.

Here I got the example of using geolocation API, this document is the specification defines an API that provides scripted access to geographical location information associated with the hosting device.

here is the sample code that they shared


So to implement this thing I want to check weather it work on normally on Salesforce or not, So I created a detail button on Account to check the code. I created a geolocation type field on Account object, and created a detail button on it adn added it to the layout.

Here is the detail page button "Check-in" and "Geolocation" field, just click on check-in button you will the current geolocation, to know more about the geolocation field click here


Here is the code of the check-in detail button, please put Behavior as Execute JavaScript of the detail button.

1:  {  
2:    !requireScript("/soap/ajax/26.0/connection.js")  
3:  }  
4:  navigator.geolocation.getCurrentPosition(function(position) {  
5:    var longitude = position.coords.longitude;  
6:    var latitude = position.coords.latitude;  
7:    var account = new sforce.SObject("Account");  
8:    account.id = '{!Account.Id}';  
9:    account.Geolocation__Latitude__s = latitude;  
11:   account.Geolocation__Longitude__s = longitude;  
12:   var result = sforce.connection.update([account]);  
13:   if (result[0].getBoolean("success")) {  
14:        alert('Account updated successfully');  
15:        window.location.reload();  
16:   } else {  
17:       alert('Error : ' + result);  
18:   }  
19: });  

Just try above code, it works like charm. Happy to answer any query.
Hope this will help someone.

Happy coding!!

Tuesday 11 August 2015

Bootstrap Datepicker for Salesforce1, Google Chrome and Firefox mozilla

Was working on something and got a change for implemtation which should work with Google chrome, Salesforce1 and firefox mozilla as well, with chrome it starts working normally without any modifications, but not in firefox mozilla, I have added comments in the code where I am referring libraries to make datepicker to work in Mozilla.

this is how bootstrap datepicker looks in chrome


This is how it looks in Firefox mozilla


And now in datepicker Salesforce1


Here is the code of the above datepicker

1:  <apex:page showHeader="false" sidebar="false" docType="html-5.0" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="false">  
2:      <html lang="en">  
3:        <head>  
4:          <meta charset="utf-8"></meta>  
5:          <meta name="viewport" content="width=device-width, initial-scale=1"></meta>  
6:          <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"></link>  
7:          <!-- script for mozilla without these datepicker will work in chrome but not in mozilla-->  
8:          <script src="https://cdn.jsdelivr.net/webshim/1.14.5/polyfiller.js"></script>  
9:          <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>  
10:          <script type="text/javascript">  
11:            webshims.setOptions('forms-ext', {types: 'date'});  
12:            webshims.polyfill('forms forms-ext');  
13:          </script>  
14:        </head>  
15:        <body>  
16:          <div class="panel-body">  
17:            <div class="form-group" ng-hide="hideformobile">  
18:              <div class="col-xs-12 form-group input-append datepicker">  
19:                <label>Datepicker</label>  
20:                <input type="date" id="mydate" size="16" class="form-control"></input>  
21:              </div>  
22:            </div>  
23:          </div>  
24:        </body>  
25:      </html>   
26:    </apex:page>  

Felt like posting it, as datepicker can take time to implement as it took mine, it works awesome on Salesforce1.

Thanks Happy coding!!

Sunday 26 July 2015

Salesforce Sales Cloud Consultant Certification Experience

Hi all, few days ago cleared my Salesforce Sales cloud consultant certification, I would definitely say that this certification have enormous amount of scenario based questions, it was absolutely not easy exam, I prepared allot then also I was afraid, but if you just go through the content and get in-
depth knowledge of the process of Sales cloud platform then nothing can stop you.

The Salesforce.com Certified Sales Cloud Consultant is able to successfully design and implement Sales Cloud solutions that meet customer business requirements, are maintainable and scalable, and contribute to long-term customer success.
These below links are recommended by Salesforce before appearing in exam + read this post Mr. awesome "Bob Buzzard" for Salesforce Certified Sales Cloud Consultant


Documentation, Tip Sheets and User Guides can also be accessed through Help & Training. Documentation is also available in PDF format here: PDF

Sales cloud is a non technical but more about the experience in designing solutions that optimize the Sales Cloud functionalities. This exam is about how a consultant will help their customer to implement Salesforce. I personally recommend to watch this video, this video its amazingly great and will help you ramp up on the Sales cloud functionalities. This is a Dreamforce video



Key points that are listed in high percentage area in the Study Guide

1. Design of end-to-end sales process from lead to opportunity to quote to close to order.
2. Capabilities and use cases for territory management.
3. Use cases and design considerations when implementing Orders.
4. Appropriate uses cases for Account and Opportunity Teams and the effect on sales roles, visibility, access, and reporting.
5. Determine the relationships between sales stages, forecast and pipeline.
6. Chatter enables collaboration in the sales process.
7. Capabilities and use cases of work.com pertinent to sales productivity.


Hope it helps, all the best for the exam!!

Saturday 18 July 2015

Salesforce - "Summer of #Trailhead" Bangalore meetup Experience

Hi all, I am here again to share some amazing experience of Salesforce meetup "Summer of Trailhead", its all about trailhead practice and awesome experience that trailhead gives to a learner of Salesforce, its an amazing place to learn and explore new things. I have already posted my Trailhead experience on my Salesforce #trailhead : Place to Learn, Explore & Play post.

Thanks to all the Salesforce geeks to join us on the meetup, thanks to Salesforce for sending us awesome goodies, I feel proud when I got some of those, along with goodies we got amazing trailhead stickers and books and the amazing t-shirts.


There was hands on for those who are new with trailhead, people took few badges as well, it was amazing when a bunch of people are trailing and tweeting about trailhead, take a look at one of my tweets



It was an amazing experience while helping and learning with new geeks of salesforce, salesforce is now a relation between two humans. Thats what I saw in the summer of trailhead meetup.

I cannot thank enough for the amazing book that I won at trivia of the meetup "Advanced Apex Programming" written by Dan Appleman I will finish this one asap, then will definitely post some new learning from the book.


Once again after #lightning meetup felt awesome to meet salesforce plumbers and newbies.
Thanks Salesforce and everyone.

Keep trailing!!

Friday 19 June 2015

Paging using AngularJS and Bootstrap in Salesforce


AngularJS is a toolset for building the framework most suited to your application development. It is fully extensible and works well with other libraries. Every feature can be modified or replaced to suit your unique development workflow and feature needs.
Want to know more and learn about angularJS Click here this is a re-post of the blog written by Vivek Deepak

Here is the page how its looks, the awesome thing about this page is angular the functionality in too much less coding, that what I just loved about AngularJS
Take a look at this


Here is the small controller class using remote Action to fetch the account records.

1:  global class BlogOneController {  
2:    @RemoteAction  
3:    global static List<Account> getAllAccounts() {    
4:      return [SELECT Id,Name,BillingStreet,BillingCity,BillingState FROM Account];  
5:    }  
6:  }  

Here is the code of the page using AngularJS to show the data on the page, using AngularJS and Bootstrap

1:  <apex:page showHeader="false" sidebar="false" docType="html-5.0" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="false" controller="BlogOneController" >  
2:  <html ng-app="SampleApp" lang="en">  
3:    <apex:stylesheet value="{!URLFOR($Resource.bootstrap,'/boostrapStyle/css/bootstrap.css')}"/>  
4:    <apex:stylesheet value="{!URLFOR($Resource.bootstrap,'/boostrapStyle/css/ng-table.min.css')}"/>  
5:    <head>  
6:    <!-- Add CSS Files HERE -->     
7:    <script type="text/javascript">  
8:    var myapp = angular.module('SampleApp',['ui.bootstrap','mgcrea.ngStrap','ngTable']);  
9:      myapp.factory('FETCH_ACCOUNTS', ['$q','$log', function($q,$log){  
10:    var handleReq = function(remoteCall) {  
11:      var defer = $q.defer();  
12:        remoteCall(  
13:         function(result, event) {  
14:          if(event.status) {  
15:           defer.resolve(result);  
16:          }  
17:          else {  
18:           $log.error(event.message);  
19:           defer.reject(event.message);  
20:          }  
21:         },  
22:         {escape:false, buffer: false}  
23:        );  
24:        return defer.promise;  
25:       }  
26:    return {  
27:        getAllCustomers: function() {  
28:          return handleReq(BlogOneController.getAllAccounts);  
29:        }  
30:      }  
31:  }]);  
32:  myapp.controller('MainController',['$q','$log','$scope','FETCH_ACCOUNTS','ngTableParams',function($q,$log,$scope,FETCH_ACCOUNTS,ngTableParams){  
33:        $scope.loadingH = true;  
34:        var data = [];  
35:        var promise = FETCH_ACCOUNTS.getAllCustomers();  
36:        $scope.account_list = [];  
37:        promise.then(function(response){  
38:          data = response;  
39:              $scope.accountRecords.reload();  
40:          $scope.loadingH = false;      
41:        },function(error){  
42:          $log.error('ERROR' + JSON.stringify(error));  
43:          $scope.loadingH = false;  
44:        });  
45:        $scope.accountRecords = new ngTableParams({  
46:                 page: 1,      // show first page  
47:                 count: 5  
48:                           // count per page  
49:              }, {  
50:                 counts:[],  
51:                 total: data.length, // length of data  
52:                 getData: function($defer, params) {  
53:               params.total(data.length);  
54:                 $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));  
55:              }  
56:            });  
57:      }]);  
58:    </script>  
59:    </head>  
60:    <body ng-controller="MainController" >  
61:    <div class="panel panel-primary">  
62:       <div class="panel-heading">  
63:        <h3 class="panel-title">Account Information</h3>  
64:       </div>  
65:       <div class="panel-body">  
66:          <table ng-table="accountRecords" class="table table-striped table-hover">  
67:           <thead>  
68:            <tr>  
69:             <th>#</th>  
70:             <th>Account Name</th>  
71:             <th>Street</th>  
72:             <th>State</th>  
73:            </tr>  
74:           </thead>  
75:           <tbody>  
76:            <tr ng-repeat="account in $data">  
77:             <td>{{$index+1}}</td>  
78:             <td>{{account.Name}}</td>  
79:             <td>{{account.BillingStreet}}</td>  
80:             <td>{{account.BillingCity}}</td>  
81:            </tr>  
82:           </tbody>  
83:          </table>    
84:       </div>  
85:      </div>  
86:      <apex:includeScript value="{!URLFOR($Resource.bootstraptpls, 'bootrapangular/angular.min.js')}"/>  
87:    <apex:includeScript value="{!URLFOR($Resource.bootstraptpls, 'bootrapangular/angular-strap.min.js')}"/>  
88:    <apex:includeScript value="{!URLFOR($Resource.bootstraptpls, 'bootrapangular/angular-strap.tpl.min.js')}"/>  
89:    <apex:includeScript value="{!URLFOR($Resource.bootstraptpls, 'bootrapangular/ng-table.min.js')}"/>  
90:    <apex:includeScript value="{!URLFOR($Resource.bootstraptpls, 'bootrapangular/ui-bootstrap-tpls-0.11.0.js')}"/>  
91:  <!-- Add JS Files HERE -->  
92:  </body>  
93:  </html>  
94:  </apex:page>  

For the Angular and Boostrap files please click here

Happy coding!!



Wednesday 10 June 2015

Improved SAQL in Spring'15

The SAQL language is a real-time query language that enables ad hoc analysis of data that’s stored in dataset
SAQL is influenced by the Pig Latin programming language, but their implementations differ and they aren’t compatible.
SAQL is procedural, which means that you describe what you want to get from your query. Then, the query engine decides how to serve it efficiently. SAQLis compositional. Every statement has a result, and you can chain statements together.
Salesforce Analytics Query language (SAQL)
We already know about SOQL and SOSL. This is new Query language for Analytics cloud to enable ad hoc analysis of data stored in dataset. This is still in pilot.
 IDENTIFIERS Identifiers are case-sensitive. They can be unquoted or quoted. Unquoted identifiers can’t be one of the reserved words and must start with a letter (A to Z or a to z) or an underscore. Subsequent characters can be letters, numbers, or underscores. Unquoted identifiers can’t contain spaces. Quoted identifiers are wrapped in single quotes (') and can contain any character that a string can contain. 





Happy Coding!!
Cheers


Friday 24 April 2015

Salesforce #trailhead : Place to Learn, Explore & Play

A game that will teach you Salesforce while playing



When I saw and started working on trailhead for the first time, I loved it so much that at the same time I end up getting 8 badges, one of my friend is a salesforce learner, I just pinged him trailhead link and tell him to start now he is salesforce certified Developer because he cleared most of the issues in trailhead practice.


Few things I loved about trailhead...

Its amazingly developed for the learners, that they will start loving Salesforce.
Whatever the new things updated in Salesforce in these recent release are out there on #Trailhead to practice.
Awesome explaining
Trailhead has broken down the Salesforce 1 platform into various sections known as “modules” and these are further divided into units so that one can learn those sections step-wise. Anyone who is new to Salesforce or wants to learn more about Salesforce can use the Trailhead. One can select the module as per his background (developer or administrator). Trailhead is also a great resource for anyone studying to take a Salesforce Certification exam.

Write now out there trailhead have these modules, go grab the badges now now now..


My favourite one is Process Automation, lightning , flow everything is there to learn



I got the CATTER also, I can make you jealous because it was on Trailhead for limited time period now its not on trailhead


If you are new to Salesforce, looking to enhance your Salesforce skill set, or just looking to brush up on your Salesforce knowledge, then I’d highly suggest hiking over to Salesforce’s Trailhead and trying it out: #trailhead

Hopefully this post has gotten you excited about trying Trailhead for yourself. Go earn those points and badges! Please also help us spread the word and make Trailhead a verb. So the next time someone asks you, “What is the best way to learn Salesforce?”, you’ll have the best answer, “Trailhead it”.

Happy trails!

Saturday 18 April 2015

Replicating one Salesforce org to another + Mass Deployment + Best Practice + Salesforce

Recently I was trying to replicate one Salesforce Sandbox org to Developer edition org, Sandbox was fully developed, sandbox had many components + dependecies, you cannot just deploy everything in one shot, So you need to make a checklist before the deployment for the components you are going to deploy.

Start checking in the components in order of below list

  • Check Appexchange apps installed.
  • Standard Object Modifications i.e Custom Fields or Field History Tracking or Assignment Rules (Suggestion is to use IDE for this).
  • Custom Objects i.e Custom Object and Custom Settings ( Here you can face issue if you have formula fields which is using related objects field values like CustomObject__r.Phone__c in the formula field )
  • Remote Site Settings, Static Resources, Roles Custom Button and Custom Links etc
  • Now Trigger, Apex Classes, Test classes and Visualforce Components and Visualforce pages.


I am using ANT and IDE, if you are using ANT please specify the profiles each and every time in your package.xml file.

In writing its looks too less but it would be too much at the time of deployment, While deploying keep this in mind that we are not using change sets, now your only hope is ANT and IDE.
for ANT users while deploying specific Standard objects custom Fields and that is 50 in count and pasting the custom fields name in package file, that is seriously annoying process I feel. So according to the list we should deploy all the Standard and Custom object fully using IDE, below is the process of deployment using IDE, after that there is an ANT package file snippet that you can use to deploy everything from one org to another org.

Process of fetching all the components in the IDE for the deployment (Specificaly fetching Standard Objects custom Fields).

i. Go to IDE open you Project

ii. Right click on the Project and click on Force.com followed by Add/Remove Metadata Components.


iii. Now click on Add/remove button highlighted below


you will get this notification message click ok



iv. Now select those components that you want to add the metadata in your IDE, like I have select Standard Object and the fields.





v. After selecting the components, you can see the selected componenets then click Apply


vi. Now you have added the components in your IDE.


vii. Right click on the object and select FORCE.COM and Deploy to Server


viii. Pass you credential of the dev org.


ix. Click NEXT


X. Click NEXT and you are done now



I have shown the above process to deploy standard Objects fields and then Custom object in sequence without wasting you time in the creation of the of the package.xml file.

Now just put the below code format in your package.xml file keeping in mind the deployement is done of the dependent components according to list in the starting I mentioned.

1:       <types>  
2:      <members>*</members>  
3:      <name>ApexClass</name>  
4:    </types>  
5:    <types>  
6:      <members>*</members>  
7:      <name>ApexComponent</name>  
8:    </types>  
9:    <types>  
10:      <members>*</members>  
11:      <name>ApexPage</name>  
12:    </types>  
13:    <types>  
14:      <members>*</members>  
15:      <name>ApexTrigger</name>  
16:    </types>  
17:    <types>  
18:      <members>Lead.104</members>  
19:      <name>AssignmentRule</name>  
20:    </types>  

NOTE : Put star(*) when you want to deploy all the components.

The above process will surely help you, when you are mass deploying
Please go to these links for more information and expertise in ANT TOOL

Installing the Force.com Migration Tool
Force.com Migration Tool Guide
Using the Force.com Migration Tool

I am a great fan of ANT tool, and anybody will also become when we will use ANT AT ITS BEST.

Enjoy the force !!!