December 25, 2012

Better Salesforce Code security compliance via *NEW* Checkmarx online code scanner

Security compliance of code is important, and it's tough to escape when you’re planning to list your app on AppExchange. My previous post about the “Preparing for security review process” lists various steps for the same. One of the steps required is passing your code to “ security scanner”, this scanner scans the code and emails you back the results. This worked decently in past, but would be nicer if:
  • We don’t have to wait for scanner’s email to come, as its delivery time is not guaranteed to be within X hours.
  • One can track the code quality for improvement or degradation over the time.
  • Integration with code versioning system like GIT, to pull and scan the results as required.

Exploring – *NEW* Checkmarx Online Code Scanner

I recently came across this new online code scanner by Checkmarx. This scanner address all of the problems listed above and gives rich insights. Here are a couple of video screencasts that walk you thru functionality of this new scanner.

December 24, 2012

Fixing performance and memory issues in Eclipse or IDE

Eclipse needs a decent amount of heap(Memory | RAM) to work smoothly, minimal heap sizes start from 256 MB RAM and upper limit to that value usually depends on the eclipse plugins and amount of physical RAM installed on your machine.
Chances of eclipse being slow on low heap configuration are high, this is because you are overloading your processor and disk in classic RAM <> Disk swap cycles and CPU processing going on during the same. If this heap falls below a certain level, you might see Eclipse crash with errors like “OutOfMemoryError: Java heap space”.
This post tries to cover a couple of Eclipse flavours/variants and ways to fix performance and memory issues on the same. As IDE itself is based on Eclipse, so most of the tips apply to IDE users as well.

How to fix Performance ?

Mystery behind exciting node names !

I recently used, the thing that surprised me most was node naming convention, which is pretty much like Heroku, that gives similar exciting names to your nodes, for example node names are like this only, for example

December 14, 2012

Chatter Share button for Salesforce & Publishers–Preview !


I am no more involved in active development of this button, and strongly believe that it should come from Salesforce only, this is specially *CRITICAL* for the data security reasons of enterprise customers. Based on early feedback I got about this button, major concern raised was

How info-sec team of my org can trust and approve this button regarding illegal use of sensitive enterprise data ?

This point makes sense to me, as this button requires OAuth token access to the org. So, please consider this as a hobby project from my side and I would like to see Salesforce to deliver something like this in near future.

For now, to solve the security point, I am planning to create a browser plugin for the same (stay tuned for more updates !)

Social sharing buttonsChatter share button is something being asked for since launch of Chatter. A Share button for chatter will basically do the same thing as Twitter’s tweet button or Linked In’s share button does i.e. share a link to the social platform.

Idea to develop a share button for Salesforce chatter was bugging me since Chatter launch, but got a chance to complete this button recently, with huge help from Prateek, he is lead engineer for this button and turned this idea into reality.


November 7, 2012

Easy QR Codes generation in Salesforce without writing “CODE”

QR codes are simple and fast, its quick way to transfer information around. One of the good example of that could be seen in Dreamforce, where QR codes are their in the event invites for registration and member badges for quickly creating the contact in mobile app.
QR Code scanning apps are pretty much available on all major mobile platforms. So, powering your Salesforce org with QR codes opens a lot of possibilities for quick sharing of information in various scenarios like,

October 7, 2012

Slides and recordings from Chennai Salesforce Platform Developer meetup–October !

Chennai October meetup went well yesterday with sessions on topics ranging from Apex, Heroku etc. I enjoyed delivering my session over Google hangout a lot, it for sure saved the travelling time and cost across cities, plus opens more possibilities to be present in other meetups as well.


I delivered a session about “Parsing XML/JSON in Apex”. Goal of this session was to increase awareness about the better API available in platform for XML and JSON handling. Here are the slides for the same:

August 31, 2012

Chatter enhancements in Winter’13 release !

Feeling for reading salesforce release notes is close what I feel when I am unpacking a shipped gadget, its same excitement to see and feel.

Here are my fav. chatter features from this winter’13 release

Chatter Polls

Just like Facebook, it allows one to easily create polls that will appear in chatter feed. This would really help, because I previously achieved the same by counting like on comments(venue options in the example below)

August 18, 2012

Creating easy rollup summary fields in salesforce

Rollup summary fields are pretty common requirement in customizations and app development. Rollups are easy to create on master-detail relationships as they are available as a field type. But on certain limits/situations we need to write apex code for rolling up the child information for common aggregations like COUNT, SUM, AVG, MAX/MIN etc, some of these limitations are

The 'USUAL' approach to handle this limitation is to either

  • Write trigger on various DML(reate, Update, Delete/Undelete) events on child sobject. These trigger either manually aggregated the information via Apex or used SOQL Aggregate queries for the same.
  • Write some batch/scheduled apex to perform this nightly.

I tried solving this problem by creating a small apex utility called “LREngine”. Complete description and details about it are available here on github:

July 19, 2012

When is ExtJS really right for Salesforce Apps?

I recently got chance to work on Ext JS 4+ MVC. This post tries to state some experiences, so that it can help other companies and developers making wise decisions about opting Ext JS for a business requirement. We will explore Ext 4 MVC in general and salesforce point of view in the points below:

July 18, 2012

Take aways from Salesforce Noida Developer Meetup !

imageNoida meetup was great opportunity to connect with peers. We had good presentations and knowledge exchange, here is the briefing of those presentations

July 14, 2012

Generating Base-64 SHA-1 Signature Header for Rackspace API in Apex

This post shares small code snippet to generate base-64 SHA1 Hash, which is typically used in passing as signature header to some APIs. We tested this snippet with Rackspace API Signature Header, which requires a base-64 SHA1 Hash.

The key point to note here is we need to encode the binary hash, not the hex hash, into base-64 and thus the resulting string should be 28 characters long. Here is the gist snippet to generate the hash

July 6, 2012

Upcoming Salesforce Dev events in India (July’12)

imageYes, this is true team is coming to Noida and many other cities in India this July’12. We always saw team doing lots of dev meetups and events all around the globe, India only got limited events few years back.
But this time Salesforce team is coming with big bang, i.e. with events and workshops in 4 core cities of India i.e. Bangalore, Pune, Hyderabad and Noida.

June 14, 2012

Visualforce Javascript Remoting,Namespace handling improvements in Summer’12 release


Javascript remoting is great feature, and I used it a lot in many of projects since feature inception.  Remoting  has gone thru a couple of enhancements in past few releases for ex. previously it was a must for Remoting Apex class to be global, now we this is optional and one can use normal public Apex classes with Remoting as well.

Other major issue with Remoting was regarding namespace prefix handling in prefixed and non-prefixed orgs, a couple of scenarios for that could be:

May 24, 2012

Apex Summer’12 Comparable interface Sorting Examples : Part 2 (Multi Attribute/Order Sorting)

In previous post i.e. “Apex Summer’12 Comparable interface Sorting Examples : Part 1”, we saw how easily we can sort a UDT(User Defined Type) on various attributes like Date, Datetime, String and Numbers.

This post will demo how we can get the ability to sort on

  • Multiple attributes
  • Both ASC and DESC sorting orders

May 23, 2012

Apex Summer’12 Comparable interface Sorting Examples : Part 1

I am happy about the native sorting support in Apex for UDT(User Defined Types), I was missing this a lot since I am java developer who is used to of Comparable and Comparator based sorting.

Another reason of drafting this post, is because I didn’t liked the sorting example available in apex developer guide, this example is complex way to achieve the desired.

Sample APEX Class

Following apex class with following 4 different type of attributes is used for illustration

  • Name : Type = String
  • Age : Type = Integer
  • DOJ : Type = Date
  • checkInTime : Type = Datetime

Salesforce summer’12 Sorting enhancements reviewed !

With summer’12 release, I was very happy to see the ability to sort Non-primitive data types in apex with availability of List.sort() and Comparable fixture. Having native or system sorting support is great, but few gaps are their as well.

May 21, 2012

Salesforce Summer’12 Release Favourites ! Summer’12 Release brought some interesting and much awaited enhancements, this post briefs the ones that interested me most.

PDF Rendering Pipeline Optimizations

As the release notes say they have improved the processing to render the PDF pages faster. I came to know previously page is processed twice, thus constructors + action functions are invoked twice as well. This change is good, but I found few peers struggling with the same, even release notes warn to do extensive testing for this upgrade.

May 11, 2012

Location sharing/glimpse in Salesforce–Again !

Somewhere back in June’2010 team organised a chatter challenge, and I submitted an App called Location Glimpse for the same, which scored 3rd prize.

My idea was to extend and take it to next level, but can’t spare time afterwards. These days we made some progress on the same App with my fellow developer Kanishk. Here is a video of what is cooking and coming up now

Looking forward for your views on the same.

April 20, 2012

Accessing Sobject Field Sets in Apex Code !

I recently came across a problem, where I need to query the fields to be shown via FieldSet via Apex Code (No Standard Controller Love). After struggling for a while with Apex docs, I googled for the same and found an idea posted for the same.

So, I thought lets try using dynamic bindings in visual force if they can get the job done for me. Fortunately it worked like a charm in one go. Here is the solution

April 15, 2012

Chatter Apex Test Case Bug in API version 24

I noticed this issue while writing an Apex test case for some chatter related functionality. For sake of this post, I am just posting the simplified test case. Here is the code

public static testmethod void testFeeds() {
    // Create a Test Account
    Account acc = new Account(Name = 'Demo Account');
    insert acc;
    // Create FeedItem using this Account as a Parent Record
    FeedItem fp = new FeedItem();
    fp.Body = 'Testing via Apex';
    fp.parentId =;
    insert fp;
    // Query AccountFeed back to verify if the post was created correctly
    AccountFeed[] accFeed = [Select Id, Body From AccountFeed Where ParentId =:acc.Id];
    // should be 1 record in the feed for this accountid
    System.assertEquals(1, accFeed.size());

April 11, 2012

Fighting and fixing the “MIXED_DML_OPERATION” error !

“MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Account”

You can easily run into this error if you are trying to perform DML on setup and non-setup objects in the same transaction. Non-Setup objects can be any one of standard objects like Account or any custom object, here are few examples of the Setup Objects

  • Group1
  • GroupMember
  • QueueSObject
  • User2
  • UserRole
  • UserTerritory
  • Territory

This error typically comes in two different scenarios i.e.

March 12, 2012

Fixed – “Compile Error: Type is not visible: test”

“Error: Compile Error: Type is not visible: test at line…” was bugging one of my peer developer for a while. For us, it was coming at a line in source code where Test.startTest() call is made, though it can come at any other use of any method from “Test” class.

First we thought that API version of the class is not to the latest, but then we recalled that its not Test.isRunningTest(), but Test.startTest() that is failing, which existed since last 3+ years. Then what could be the problem ?

The problem came because some developer created an apex class named “Test.cls”, its unfortunate that its allowed, but it is. This messed up the Apex runtime and on some occasions it worked but failed on most of the places where we are referring the SYSTEM Test class.

We learned this lesson a hard way, by wasting a lot of time. Posting this to save time of other developers who will google for this strange issue.

Posted the same on IdeaExchange, please promote :

February 12, 2012

Salesforce streaming API and Chrome desktop notifications

I likeimage chrome desktop notifications a lot, they specially help me with gmail running in browser always and keeping me updated about new mails/chats without keeping the gmail tab open. I also like the way gmail desktop notifications in chrome take to the email related with the notification, again saves time and clicks.

Salesforce PushTopic Desktop Notifications

I wanted something similar with Streaming API or the PushTopic notifications. If you are working on a crucial Campaign, Account, Lead or Opportunity, then instead of waiting for chat/email/phone for updates, one can setup PushTopics and get updated in close to real time using “chrome desktop notifications”. Something like this:

February 10, 2012

Tip: Using Decimal class with Strings in Apex

Today I came across an interesting problem that reminded me of my Java days. A piece of Apex code written by some other developer was broken, when I did my fixes.

Here is some background about the broken code, lets say the file name is “ScaryMovie.cls

February 9, 2012

jQuery-Mobile, HTML5, Javascript Remoting and Visualforce in Cooking !

For fun of cooking a mobile application, my peer developer Jagdeep developed a jQuery mobile based app prototype using Visualforce pages and Javascript Remoting on

Here is a quick demo video of this application.

We’re happy about this small experiment because of a few reasons

February 1, 2012

New Idea, Getting Field ID in Apex Describe Information !

If you are planning to default input field values in an edit page for an Sobject, then you need to use something cryptic, like LKID hack. This hack requires you to pass field’s IDs as URL query params with default values for each, like:{!Case.CaseNumber}&CF00N30000001cYtG_lkid={!Case.Id}&retURL=%2F{!Case.Id}&saveURL=%2F{!Case.Id}

This solution is really a hack, as there is no way in Apex describe information to know ID for a given sobject field. This makes your app or solution tough to port across the orgs, developers try to use custom settings to declare all such LKID fields, each one of them must be correctly updated by Admin post app installation.

January 31, 2012 Developer Console Navigation Trick

I never thought that working in browser can be more fun than Eclipse IDE. But my thinking is changing these days, first became my favorite playground for any HTML/Javascript research and now I felt Developer Console is way more convenient and faster to work as compared to Eclipse, reasons:

Describing picklist values for Sobject with multiple RecordTypes !

I recently came across an interesting problem mentioned in this post by  Mr. Keir Bowden(@bob_buzzard), solution mentioned in this post was cool and it excited me to try an alternate one that started drawing in my mind, while I was reading his post.

January 29, 2012

Salesforce Email Services - Where is "Delete" button ?

Deletion of email services is interesting, recently one of my team member approached me about, why “DELETE” button is not coming on configured Email Services ?

Same is indicated in screenshot below:

Salesforce email service no delete button visisble

January 18, 2012

Crowd sourced getting started guide for developers.

Screen Shot 2012-01-18 at 5.11.38 PMGetting started with platform is an interesting roller coaster ride for developers of any experience level. I tried bringing some of those newbie experiences in this post, and then a guide that can help newbie’s to get up to speed quickly with platform.

the newbie story !

Fresh graduates mostly compare it with C/C++ and try searching out similar fun out here.

For experienced it’s a different sort of comparison from various degrees and angles :) I was from Java/J2EE background for me it was a huge change in mindset, i.e. I was missing

January 16, 2012

Multiselect picklist jquery plugin for iPad and Desktop browsers

We recently came across a problem, we have to develop a multi-row/multiselect picklist that looks similar in both desktop and iPad browser.

We could have easily used the usual Visualforce tag i.e. <apex:selectList …/> for the purpose, like this

<apex:selectList id="contactPickList" value="{!selectedContactIds}"  multiselect="true" size="4">
   <apex:selectOptions value="{!contactOptions}"/>

But iPad doesn’t supports “size” attribute on HTML <select> tag, and to save real state on page it always shows picklists in one line. Picklist options are shown in popup on click.

We are troubled by this difference, as the UI was looking very different in iPad and desktop. You can assume that we are developing UI having Salesforce “Customize you tabs” type interface, here is the difference

January 14, 2012

January 2, 2012

Yet another Apex Trigger Template !

I know Trigger templates are previously discussed also in great detail. We have excellent posts available by Steve Andersen(Gokubi) and Mike Leach on the same. Here is my small journey on Triggers

  • I started developing on, I used bare bone approach as mentioned in Apex developer guide.
  • After sometime I was  using something similar to what Steve mentioned in his blog, I was happy to see that Steve suggested a similar practice.
  • Eventually tried something that is similar to what Mike suggested in his blog.

After trying all of the above trigger templates, I was still not happy when working solo or when working with a big team of engineers on the same project. I wanted something simple to adopt easily with flexibility to extend/add as required.