Skip to main content

Posts

Showing posts from November, 2010

Displaying Aggregate result on Visualforce using SOQL

There are some who jump out of bath-tub nearly naked when they are highly excited, fortunately I am not one of them, but when I saw the Aggregate functions in Spring 10 release, I was nearly in tears, ok, thats too dramatic but Aggregate functions giving a very beautiful meaning to data altogether. For those of you who knew SQL you obviously know what aggregate functions are and how they beautify your code. Those who do not know, aggregate functions help you aggregate the date based on certain field. Say for example, you want to show the count and Opportunities created on a day, you can aggregate them using SOQL. AggregateResult[] groupedResults = [SELECT Name, Count(Amount) FROM Opportunity GROUP BY CreatedDate]; So how do we display it on Visualforce: Just iterate on the AggregateResults and get elements one by one. for (AggregateResult ar : groupedResults) { System.debug('Created Date' + ar.get('CreatedDate')); } A few pointers for debugging: 1. Alw

Salesforce Social Inc

Do you know Salesforce sits beautifully in the middle of your social-marketing strategy? No, I am not saying this by taking money from them, (I do however wish they paid me for advertising), but I am saying this because I just had a glimpse of how Salesforce-Social CRM and yes, the picture that was painted was amazing. So how do we achieve it? Lets have a peek. 1. Google Search/ Google Adwords/ Facebook Advertising/ Your Public Domain Site/Slideshare.net/Youtube The Salesforce native Web-to-lead form can be used very beautifully here. Create a web-to-link from and host it on your own domain name website. Provide its link as the click-thru URL in the above sites and just collect the leads. Psst. Create a URL parameter and you can actually track the lead sources in these pages. If you are looking for a much more sophisticated concept, use the Salesforce Idea controller and let people publish ideas for you. Read more about Idea below. 2. Twitter Sales/Service Want to monitor y