Saturday, 21 June 2014

#Salesforce Integration With Twilio

I was searching Twilio integration with salesforce on the web but didn't find any, so am posting this a simple POC of sending SMS to the mobile using Twilio from the Salesforce UI.


Its simple but just you need to do something extra two make this functionality working.

We will go step by step for this
First of all create a new account on Twilio click here 
Twilio will provide you a number, via which it will sent you SMS.

Now login to your salesforce account and create a Remote Site Setting.
In Remote Site URL enter https://api.twilio.com, like shown below

And then create a custom setting named as Twilio Configuration.
We are gonna use them in our apex classes.
Create fields on the custom setting you've just created, with same API name as below shown.


Now we need to provide some values to the fields ofthe custom setting click on Manage button shown above.

Before entering any values to the fields click on these links
For Auth Token and Account SID Click Here
For Test Credetials i.e. Test Account SID and Test Auth Token Click Here

For Account Name enter the name from which you registered like your email id.
For From Phone Number enter that number which got when you created account on Twilio.
After that save your custom setting.

Custom Setting should look something like this


After that you can save the code provided here GitHub 

Page will look something like this




See that was a piece of cake :)
Hope everything works just fine.
Happy coding..!!!

Tuesday, 17 June 2014

Basics of Apex Trigger for beginners

The basic logic of trigger is too huge to cover, I have tried a bit to make everyone understand that how this Apex trigger, a "pain in ass" works, I'll go step by step process of writing apex triggers.

What is Apex Triggers ?

A Trigger is Apex code that executes before or after the following types of operations:
  • insert
  • update
  • delete
  • merge
  • upsert
  • undelete

Types of Apex Triggers


  • Before Triggers: Before triggers can be used to update or validate record values before they are saved to the database.
  • After Triggers: After triggers can be used to access field values that are set by the database (such as a record's Id or last Updated field), and to affect changes in other records, such as logging into an audit table or firing asynchronous events with a queue.
Example : before insert, after insert, before update, after update, before delete, after delete

Syntax of Trigger

Things to keep in mind while writing apex trigger

  • Bulkify your Code : Use Looping through Trigger’s collections variables instead of process through particular indexing.
  • All triggers are bulk triggers by default, and can process multiple records at a time.
  • Bulk triggers can handle both single record updates and bulk operations like: Data import, Force.com Bulk API calls.
  • Bulkify your Code : Use Looping through Trigger’s collections variables instead of process through particular indexing.
  • Avoid SOQL Queries or DML statements inside FOR Loops: An individual Apex request gets a maximum of 100 SOQL queries before exceeding that governor limit. 
  • Bulkify your Helper Methods: if a trigger uses some Apex methods written in a helper class, it's important that those shared Apex methods are properly designed to handle bulk records. These methods should be written to be invoked with a set of records, especially if the method has a SOQL query or DML operation.
Use @future appropriately:
Here is a list of governor limits specific to the @future annotation:
  • No more than 10 method calls per Apex invocation.
  • No more than 200 method calls per Salesforce license per 24 hours.
  • The parameters specified must be primitive datatypes, arrays of primitive datatypes, or collections of primitive datatypes.
  • Methods with the future annotation cannot take sObjects or objects as arguments.
  • Methods with the future annotation cannot be used in Visualforce.

Use efficient collection variable of apex triggers




Try using sets and maps to handle bulk record processing.



TRIGGER BEST PRACTICE

  • Always use helper class in your trigger, and in helper class perform all your logic. like below
  • Don't write more then one trigger on an object, try to add up all your new trigger in a single trigger using different-different helper classes to read more click Order of Execution
There is allot to take care of when writing apex triggers, but I found these to helpful.
Hope this helps 
Happy coding.!!!




Sunday, 1 June 2014

Salesforce Multi-Select Picklist Using JQuery

I have implemented this good looking mulkti-select picklist on our Salesforce Visualforce pages.
It is so easy to handle and more user friendly as it looks.


User can select multiple option as it does in Salesforce Mutli-picklist fields, and values will be succesfully get saved in database.

User can choose more then one option by check options write in the front of the values.


You need to refer Jquery and Javascript from the static resource.

Here is the Visualforce Page code Visualforce Page

Here is the Apex class

Here is the link of github repo https://github.com/abhitripathi/MultiSelect-Jquery

Happy Coding..!!!

Wednesday, 28 May 2014

Book Review : Getting started with SOQL

Recently I got an opportunity to review the book "Getting started with SOQL"by Magulan D.
The book contains all the aspects of Salesforce Object Query Language(SOQL). Here are my thoughts...

The books starts with the basics of SOQL, difference of SOQL and SQL and valuable implementation of SOQL and then all the clauses that we use in SOQL.
Most of the time developers didn't know what they can do with SOQL. As a developer or as an administrator in Salesforce.com, we write many SOQL statements to fetch and validate the data present in the objects.

The sample queries used in the book will help you to understand the SOQL features easily. the sample queries are intended for beginners and for developers or administrators who are new to Salesforce.com.
This book also addresses the standards and guidelines to be followed when writing SOQL statements. The standards and guidelines discussed in this book will help you to write SOQL statements without hitting any limitation set by Salesforce.com and to avoid unwanted data fetched through the queries.

Feature of SOQL is so vast, but for the beginners as well as for experts this book will teach something, even I learned allot those things that I was not using most of the time in SOQL like toLabel() method. The use of Date literals with their example implementation in the queries.

The traditional method of explaining clauses like how to write SOQL, Where to use Caps and where not, that we need to take care of whenever writing an apex class. Limitation is the one difficult thing to handle in salesforce and if we are talking about SOQL then its limitation are most important thing to take care off. In the book limitation of SOQL have been explained in a brief way.

In the end of the book author explained the some tools that we can use to execute queries, he have explained the steps of installation and how to take their best use with SOQL queries, I never used Force.com Explorer software but now am gonna to use this one.

I recommend especially those who want to expertise in SOQL or want to know the key things of SOQL at first place, surely it will help them out.
Book can be purchased from Packt, Goodreads, Amazon, Books.google

Monday, 26 May 2014

Lazy loading tree with Force.com

I was trying to find something new to work, but nothing was making me eager to do that thing, and then I found out Jeff Douglas post of Original Post
Its an awesome post like he post every time, then I tried that thing in my personal salesforce org, and within few minutes I can see that tree in my org.

He's is using Jstree, its a jquery plugin, that provides interactive trees.
To know more about JsTree www.jstree.com

So that was so simple, and too much awesome, I would love to thank Jeff for doing such great things.
What he's exactly doing is to load an Objects tree, using Jquery, jsTree and Rest Javascript and using Lazy Loading.
There is a component that he created and called that component on the page.

Here how the tree looks

Here is the Steps need to perform

1. Create an Object named Parent Object.
2. Add a parallel look-up to the Parent Object of its own. Name the field "Parent Object".
3. Create a component named as "lazyLoadingTree". paste this code LazyLoadingTree
4. Create a Visualforce Page, name it ParentObject, paste this code ParentObject

5. Here is the Static Resource that you need to create, this is called from the Component that we created earlier, you cannot save your component without this restJavascript

Cheers..!!!
Happy Coding :)

Friday, 16 May 2014

reCaptcha Using HTML and Javascript ONLY...

Googles reCaptcha , its so easy to use it using PHP and .NET plugins, but I was trying to make it work only by HTML codes,

You can read this post of for reCaptcha without plugin CLICK ME
Unfortunately I tried to search, but everybody is using PHP, and upload that PHP file on server, to use it and make reCaptcha working, but I want a single code to make reCaptha working.

Here how it looks


As my code is not perfect, I have not done anything for the errors, but yes the reCaptcha's verification is working just perfect, it fetches response and shows it to you.
Here is the code(just paste it buddy)
reCaptch HTML

Hope I've helped..!!!

CHEERS :)



Tuesday, 6 May 2014

Opportunity "Probability" Field value assignment via "Stage" Field on VF Page

As you go to the Opportunity standard edit page, when you change the value of Stage field, the Probability fields value change accordingly like 10% or 30%. But the same functionality is not inherited by the VF page, so to perform this standard functionality we need to modify our VF page, as I have done.

This post is all about setting up the values of the Probability field of Opportunity associated to the Stage fields, as if you try this normally using VF page, this functionality doesn't work as standard salesforce functionality does, but doing some javascript stuffs, it can be done.

Here how it looks on VF page, by default these values are shown

Now change the Stage field value

Here the Probability field values changes with Stage value, as salesforce Standard functionality does.

Here is the small code for this,
VF Page Code


Happy Coding..!!!

Wednesday, 23 April 2014

Branding Of Your Salesforce Login Page

Login Page Branding:
Salesforce winter 14 release Bring a New Feature Login Page Branding, able to customize salesforce login page with their own Brand. Now you can change the look and feel of your login page by adding a background color, custom logo, and right-frame content.
Follow the Below Simple Steps to Do It.

Step 1 :

Your Name --> Setup --> Domain Mangement --> My Domain


Step 2 :
Provide your Domain Name


Step 3:

You will receive an email on your Email which you have provided in Salesforce Org, Click on that URL and get Logged in.


Step 4:

GO TO --> Your Name --> Setup --> Domain Mangement --> My Domain

Then click on Deploy To Users


Step 5:

Click on Edit button under Login Page Branding Section.


Step 6:

Upload a Logo and Click Save


Step 7:

Go to your Domain URL, that you got in email, and you can have some thing like this.


Isn't is looks good :)

Monday, 14 April 2014

Login Page With CSS Styling in Salesforce


Once I need to create a login page for salesforce sites, but it should look nice, so I used CSS to make my Login page look good, am sharing this, so that you don't waste time in just styling a Page.

Its as simply and perfect as it looks


Isn't it looks good,

Here is the CSS Style code, save this file in CSS format and make it a Zip file and save it in static resource.
"LoginStyles.css"

Here is the Apex Class (this is not perfect, You need to make changes to save)
"LoginController"

Here is Visualforce page.
"LoginPage"

Hope it will save some ones time.

Happy Coding..!!! CHEERS :)

Tuesday, 8 April 2014

Dynamic Look-up of all Objects, To Make Your Life Easy #Salesforce

Some days ago, I got an requirement of mass updating, everything was just fine but got stuck at Dynamic look-up, where I need to make a single look field but if user want to that he can change it to the another Objects look-up and save the record.

That means if I want to create a single look field having dependent on another picklist of Object Names,
If user selects Account Object, then our look-up field will pop-up the records of Account object.

But if user change the Object in the picklist and now he selects Contact object, then our look-up field will pop-up Contact records.

Here is the Snapshot for more understanding.

When you chose Account

And when you chose Contact from the picklist

Then your pop-up window will show me Contact records

The code is so simple but I just like the functionality so I thought to post it.
Hope some of you will like it.

Here is Controller Class "DynamicLookupController"

Visualforce Page "DynamicLookup"

Happy Coding..!!!! CHEERS


Thursday, 3 April 2014

Salesforce DEV 401 Certification Experience

I have just passed my Salesforce Developer Certification DEV 401, I was kind of afraid of it, because of the irony that I failed once already, so I don't want to repeat my past again.

My heart was gonna come out from my chest, when I was going to click on "SUBMIT" button, but let me tell you, its still in my chest.
Anybody, with determination can pass the examination, I found these questions usefull when I was preparing, hope this will help you all.
And I have some dumps, and study material to prepare, specially for DEV 401.

Only 3 things that I would like to refer all of you for the examination.

1. Sidhesh Kabe's Book of Salesforce.
2. Recruiter App. (Here)
3. Test yourself by propofs mock tests


Practice Test 1
Practice Test 2
Practice Test 3
Practice Test 4



And here is some question, that will help you, for more dumps you can email me.


Which of the following is related to View layer in MVC Model?


A. Workflow Rules
B. Validation Rules
C. Visual force Pages
D. Custom Objects
E. Apex Class



Which of the following represents controller in Model - View - Controller Model?


A. Tabs
B. Page Layouts
C. Custom Fields
D. Visual Force Pages
E. Apex Classes



Universal Recruiters wants to make access to records in such a way that all managers should be able to access records that are accessible to their team members. Which feature of Force.com's security should be used to implement this requirement. Select the one correct answer.

Object level access to profiles
Field level access to profiles
Organization wide defaults
Role hierarchy
Sharing rules
Manual sharing



Which of these is true about the Lookup Relationship. Select one correct answer.


Parent is not a required field and may be omitted.
Deleting an object deletes its children.
Roll-up summary field can be used to perform basic operations over all children of a parent record.
Security access of the child record is dependent upon the parent record.



Which of the following cannot be used to build a complete Custom Tab. Select one correct answer.


Display an external web page.
Display data using a VisualForce page.
Show data from a custom object using the native user interface.
Display the approval process using an Apex page.



Which of the following can not be translated via Translation Workbench?


A. Custom Report Type.
B. Standard Field Help.
C. Validation Error Message.
D. Report Name



Roll Up Summary fields work in which kind of relationship?



A. Many to Many Relationship.
B. One to One Relationship.
C. Master - Detail Relationship.
D. Lookup Relationship.



Based solely on the role hierarchy a manager can do all of the following EXCEPT:


A. View, edit, delete, and transfer his/her and his/her subordinate's records
B. Extend sharing on both his/her and his/her subordinate's records
C. View all folders his/her subordinate has access to, i.e., Reports, Documents, and Email Templates
D. View records his subordinate does not own but can view



Under what circumstances would the sharing button to be enabled on a detail view for a record.

A. A developer has added the button to the page layout
B. When record sharing is enabled in the user profile
C. When record sharing is set to public read only or private for the object
D. When record sharing is set to public read/write for the object



A developer has created a time-based workflow that escalates a Lead record 10 days after it has been created if no updates have occurred. What is the best way for the developer to test that the new time based workflow rule is functioning?


A. Create a new lead record; view the outbound messages queue
B. Setup the developer for time-based workflow queue; create a new lead record; view the time-based workflow queue
C. Create a new lead record; view the time-based workflow queue
D. None of the Above



All the very best for your Exam...!!!