Thursday, 31 March 2016

10 Commandments of Force.com Programming

Howdy Force.com programmers? Programming in a multi developer ecosystem like Force.com is nothing less than a band of musicians playing in an orchestra. Different instruments produce vivid tones, but exist in harmony, churning out a beautiful melody. Similarly, keeping the originality of each developer intact, yet ensuring the code adheres to common basic protocols, is of prime importance. Adding a method to the madness is required here!

After going through multiple articles concerning the best practices around Force.com programming, I deduced that although a lot of those struck the right chord, some, however, seemed to lack practicality while writing code.

This led me to the idea of writing of this blog to share an exhaustive checklist that ensures uniformity through basic standards  and is practical to use while programming on Force.com.

I call them the "Ten Commandments of Force.com Development" and here they are....


#
Thou Shalt...
Practice
1
NOT CODE unless it is really required. Use Workflows, Approval process, Validation Rules, Roll up Summary fields, Formula fields, and Process builder etc. to accomplish the requirement.
2
Always ensure general coding sanity.
  1. Don’t hard code IDs or String values. Use custom settings, Constants (static final variables) or Custom Labels instead.
  2. Always check for nulls within code. Use String.isBlank() or  list.isEmpty().
  3. Use String.equalsIgnoreCase() instead of equality operators(== or ===).
  4. Use meaningful naming conventions for variable, class, test class, trigger and page names. e.g. (MAX_ATTEMPTS, isActive, commissionControllerTest, AccountTrigger, viewCommissions).
  5. Document your code using class and method level comments.
3
Not use SOQL statement or DML operation within loops. Always use Lists, Sets, Maps to your code. Use SOQL for loops wherever applicable.
4
Always use nested or Inner SOQL queries to fetch parents and associated child records Use selective SOQL Queries using appropriate WHERE clause, filters on indexed fields (Name, Id, Unique fields) to fetch appropriate result set optimally.
5
Ensure creating only one trigger per object Use the Trigger Handler Framework to ensure execution control, Trigger Context Variable, Recursion checks.
6
Optimize Visualforce page view state for performance. Use transient variables, minified Javascript files, Streaming API, Standard Set controllers, and remove unused variable.
7
Always ensure error logging and reporting within your code. Use try, catch or email to catch and report errors within your code.
8
Always enforce security in code. Use with sharing, FLS checks, CRUD checks, Escape URL parameters to ensure authorized access.
9
Always write unit tests based on test cases. Use Test Data creation framework along with the @isTest, test.startTest() test.stopTest(), System.assertEquals(),bulk test data, different users / Profiles, WebServiceMock, 90% code coverage and check for limit uses.
10
Always ensure modularity and reusability in code
  1. Refactor method having > 45 lines of code into smaller methods, merger multiple line of code into a single line.
  2. Remove unused variables, System.debug(), alert().

In addition to using these 10 Commandments as a guideline, Force.com programmers performing code review can use this as a tool to patrol their Force.com implementations.

Happy Coding and “May the force be with you!!”



Written by Parmanand Yadav, Salesforce Champion at Eternus Solutions
Read More »

Wednesday, 30 March 2016

Your Live Agent Adventure Begins Here..


Salesforce gives me a chance to fall in love with it again and again when I come across the splendid features it dispenses. Less did I know that I will be able set up an application that would help me interact with people from worldwide? Yes, I have done it! And even you can do it. How? The solution is LIVE AGENT.

Live Agent enables, support agents to talk to their customers in real time. It is a remarkable feature provided by Salesforce that facilitates us design WEB CHAT which is a faster and a more personal way for you to engage with your customers. So, in a nutshell, live agent helps us do our favorite act i.e CHAT!

Setting up Live Agent is a piece of cake. Following are some noteworthy points that one must consider while setting up live agent.

1) SKILLS

A skill is an ability to do something well. In Live agent, we are provided with a facility to configure skills. A skill is required so that the chats are routed to the right agent at the right time. If there are support agents who are proficient at answering technical queries related to a product, then a skill can be configured for such agents. Once we create a skill, we have an option to assign users to this skills.


2) LIVE AGENT CONFIGURATIONS

This amazing facility enables us to control the features that will be available to the agents and supervisors in the Service cloud console. Supervisors are the ‘agents’ who can monitor the ongoing chats. Features like notification sounds, supervisor management are all configured in live agent configuration. So, one can configure it as required.



3) CHAT BUTTONS AND AUTOMATED INVITATION

A chat button enables us to configure buttons which are to be placed on the site from where chats can be initiated. Every chat button has an associated skill with it and after configuring it, a button code is generated. Buttons allows us to control how to route the chats to the agents, which prechat and post chat pages must be used, what should be the agent queues lengths etc. Along with chat buttons we have another type of button “automated invites”. These are animated buttons which can popup on sites.

 

4) CHAT DEPLOYMENTS

When we configure a chat deployment, live agent generates a script for us which is to be included in a HTML page along with the chat button. This is the HTML code which should be hosted on the site in order to initiate chat sessions. Additionally, we can also control chat window branding and pre chat API access through chat deployments.



After we configure all the above there a challenge that, SF withholds us from adding one user to multiple live agent configurations at a time.

Consider a plot, where an agent is proficient in "Customer Service" as well as "Technical Support". Such an agent will have a mandate to be present in 2 "live agent configurations".

SF disallows this! If you assign the same user to a second live agent configuration, the system removes that user from the first live agent configuration without warning you.


HOW TO deal with this?
  1. Configure 'SKILLS' in such a way that the agent is included in both Customer Service and Technical Support
  2. Configure 'BUTTONS' for both the skills
  3.  Configure a 'LIVE AGENT CONFIGURATION' that includes the Mathematical UNION of the above skills.


Woo-hoo! That solves it!

To learn more:


https://developer.salesforce.com/docs/atlas.en-us.workbook_service_cloud.meta/workbook_service_cloud/service5_intro.htm




Written by Neha Sonawane, Salesforce Developer at Eternus Solutions
Read More »

Thursday, 10 March 2016

My Experience with the Salesforce Platform Developer I Certification

While soaking in the glory and accolades of my peers after passing the Platform Developer 1 Certification, quite a few people asked me for preparation tips. And suddenly it struck me! My experience could be of value to a lot of guys out there! Result… this blog, where I share my preparatory regime, experience and some tips (if you can call them that!) to help you appear and pass the certification exam.

Platform Developer I: a little Background

Last year, Salesforce announced changes to their Salesforce Developer Certification roadmap. The previous structure of the developer certification track was from Dev – 401 certification to Dev – 501 certification. However, from September 2015, Salesforce no longer offers Dev – 501 credentials to new applicants. The new certification structure enables an individual to advance through the Salesforce track in a step - by - step manner, from the Dev – 401 certification to Developer I (Programmatic) & Developer II (Advanced Programmatic) certification.


Former Structure

New Structure


Note: There are no changes in the syllabus; Salesforce has simply split the entire syllabus into two parts:
  • Platform developer 1 exam (Basic apex concepts)
  • Platform developer 2 exam (Advanced apex concepts)

Exam Format

You will find a lot of similarities here with the 401 exam but a little more time! ☺
  • 60 multiple-choice questions  
  • 105 minutes allotted to complete the exam (i.e. you have a little less than 2 minutes per question!)
  • The passing score is 68%, meaning you have to get at least 41 correct answers out of 60, which in turn leaves you with a margin of getting up to 19 questions wrong! Trust me, this was one of the most comforting factors!)
  • Registration fee: USD 200; Retake fee: USD 100
  • Delivery Option: Proctored exam delivered onsite at a testing center or in an online proctored environment, as mandated by Salesforce
  • Result: Provided immediately upon submission of exam as an on-screen text and by email.

Preparation

The Salesforce Certified Platform Developer I credential is for individuals who have knowledge, skills, and experience of building custom applications on the Force.com platform. This credential covers the fundamental programmatic capabilities of the Force.com platform to develop custom business logic and interfaces to extend Salesforce using Apex and Visualforce.

Anyone who's been working on the Salesforce platform for a while and has substantial experience on the OOTB (Out of the box) as well as custom development areas, can easily clear this exam by just revising the topics listed in the certification guide.


Topics

The questions are pretty much taken from the topics listed in the certification guide and the % of questions from the topics are similar to what is mentioned in the guide.

Sr. No.

Topics

Weightage (%) as per Salesforce Guidelines *

Weightage as per My Experience

1

Multi-tenant environment

3

Low

2

MVC architecture

3

Low

3

AppExchange

3

Low

4

Data Model & Management

12

Medium

5

Logic and Process automation

46

High

6

Visualforce (User Interface)

6

High

7

Lightning

4

Low

8

Testing

12

Medium

9

Debug & Deployment

10

High



Multitenant Environment

Tips:
  • Read benefits & constraints of sharing a single instance with multiple clients, and how enforcing limits helps to share the resources between the clients
Topic Content:
  • Benefits & constraints of sharing a single instance with multiple clients

MVC Architecture

Tips:
  • Questions simply ask which part of the Salesforce platform is related to Model / View / Controller
Topic Content:
  • Model / View / Controller architecture concepts

AppExchange

Tips:
  • A thorough understanding of managed and unmanaged packages, along with their usage covers most of the bases for this topic.
Topic Content:
  • Uses of managed package vs unmanaged package

Data Model & Management

Tips:
  • Questions were scenario based but quite simple. Concentrate more on object relationships (i.e. Master-Detail / Lookup) and different scenarios around them.
Topic Content:
  • Lookup and master detail relationships and security information
  • Usage of External ID fields
  • Import / Export data concepts
  • Operation (Create / Delete) of Schema builder
  • Evaluate the impact of schema design and its modifications, on Apex development

Logic and Process Automation

Tips:
  • Almost all questions will be scenario based or code snippet based!
  • Save execution order of apex triggers (Very very important!!). Questions will be tricky.
Topic Content:
  • With sharing and without sharing concepts (Container class / Inner class)
  • Container class, inner class and interfaces
  • Describe call information
  • Representation of picklist, multi-select picklist values in Apex
  • Exception handling
  • Sharing setting information with Anonymous block execution
  • Use of collections – List, Set, Map
  • Best practices of development, such as avoiding queries inside a loop; and avoiding DML operations inside a loop
  • Usage of normal DML operations/Database DML operations
  • Error handling concepts
  • SOQL and SOSL -  return type of both queries
  • DML statements and associated query limits
  • Workflow rules, validation rule, roll-up summary field, formula field, process builder (Note:  Using process builder, we have the ability to update child records!)

Visualforce (User Interface)

Tips:
  • Force.com page execution life cycle: basic questions would be there around what executes first
Topic Content:
  • Visualforce email template tags
  • Usage of standard controller, standard set controller, custom controller, custom extension and sharing information
  • Usage of Controller constructor or component constructor
  • Usage of Controller constructor or Apex: page action method
  • Merge fields, data binding between your VF page and Controller properties and methods
  • Usage of custom setting

Lightning

Tips:
  • If you have completed your trailhead badges on basic lightning experience, you are good to go! If not, well, what are you waiting for?
Topic Content:
  • Controller logic
  • Resource bundle
  • Benefits of lightning components

Testing

Tips:
  • Scenario and code snippet based questions
  • Best practices of test code development
Topic Content:
  • Considerations for test code development while carrying out production deployment of apex code
  • Test code for an inbound email handler class
  • Access modifiers of test classes, importance of @istest, @istestvisible, startTest and stopTest methods
  • Creating & Accessing Pricebook and product data in test methods
  • Process to store test data and load them in test method for bulk testing
  • Different places to run test classes and check their results

Debug & Deployment

Topic Content:
  • Usage of Sandbox and different types of Sandbox
  • Different ways for Deployment
  • Go through the log filters, know how to set the filters on apex classes & triggers
  • Usage of checkpoint window and debug log tab in Developer console
  • Possible source & destination in a change-set, deploy / rollback in a change-set, deployment connections

Important Reference Links


There are both scenario based questions as well as code snippet based questions. Most of the code snippet based questions were fairly straightforward without much twists.

Pro Tip: If you get stuck, try to reverse engineer from the answers available and match it back to the flow of code to see which option is the right fit for the given code.

Out of 105 minutes, it took me close to 75 minutes to complete all the 60 questions. I took 15 minutes to revise all the answers, ensured I didn't leave any question unanswered, and focused on the questions I had marked for review. Please make full use of the time available to review and confirm your correct answer.


What’s Next?


This exam is prerequisite to the Salesforce Certified Platform Developer 2 exam so I have already started my preparation for that! Be assured folks, I am going to keep you posted!

ALL THE BEST :)





Written by Yogesh Sharma, Salesforce Developer at Eternus Solutions
Read More »