Chatter Stream or Chatter Ticker …

We have this amazing thing of collaboration inside Salesforce, the Chatter – an amalgamation of best features of Facebook and Twitter.  And to add, it’s for enterprise, so its Enterprise Collaboration Isn’t that awesome!!! Chatter supports lot of things post, comments, likes, follows etc and  best part is its not just user posts, comments etc .. its data posts, comments etc i.e., even the data is part of the collaboration . That adds to awesomeness!

However, there’s been one feature which I been waiting for and always wanted to see which is auto refresh of posts (for techies – ajax refresh) without need to refresh the entire page. Without this feature collaboration doesn’t seems to be complete and web2.0 type.  An alternative to auto refresh can be a stream or ticker (like we have Feed Ticker on facebook) which keeps scrolling and shows posts / comments happening around without need to refresh page.

So I thought of building the same, and first thing I needed was a poller which can poll and see if there are any chatter posts, but that would have been too resource intensive, and would have died after few hours because of governor limits and bla … bla … And to save me, there came a really great feature The Streaming API. I’m loving it!

Two lines about API - Use Streaming API to receive notifications for changes to Salesforce data that match a SOQL query you define in a secure and scalable way. Streaming API is useful when you want notifications to be pushed from the server to the client based on criteria that you define.

So what’s next, I was super excited to get all started to use Streaming API and poll Chatter objects.  I was able to get basic streaming API program working (after few discussions around streaming api with Pat Patterson, as the API had few issues in terms of documentation).

In basic example, I created a PushTopic (a SOQL query that you want notifications about) of Account. Now as the objective is chatter stream, so I tried to create a PushTopic around chatter object, and here was entry of the Villain – PushTopic aren’t supported yet for Chatter objects (SF please enable the same @ earliest)

So what next,  trigger the rescue man came to help. Developed few triggers which will do realtime snapshot of chatter objects, and then created push topic against these snapshot objects.  This way (though indirect way) I will be able to get push notifications (using streaming API)  of chatter posts…wow, finally I made it. I got the CHATTER STREAM or CHATTER TICKER ..

The use case of this is endless,  sky is not the limit..

ChatterTicker

Road map:

  • The notifications are lost the moment page is reloaded, so will try to add something which makes them persist until user has seen them.
  • Apply Sharing Settings, as currently all messages of  all users are shown

Trust me this idea struck me in morning and by evening the tool/app was ready. Thanks to Rajesh Shah for helping me out in testing this app.

 

Make Salesforce calendar year drop-down to show earlier years

Problem:
The birthdate field on the Contact object doesn’t show previous year and neither does it allow to switch back and forth the Years part easily.

Solution:
Below example will show the last 100 years.

  1. Go to Setup -> App Setup -> Customize -> User Interface. Here make sure the ‘Show Custom Sidebar Components on All Pages’ is checked.
  2. Go to Setup -> App Setup -> Home Page Layouts. Make sure all your Home Page Layouts have the Messages & Alerts component checked.
  3. Go to Setup -> App Setup -> Home Page Components. Here, click edit for Messages & Alerts. In the textarea, copy and paste the javascript code below and save (it can just go below your normal Messages & Alerts, won’t show up on the actual page).
<script src="/js/dojo/0.4.1/dojo.js"></script>
<script src="/soap/ajax/11.1/connection.js" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("dojo.collections.Store");
dojo.require("dojo.charting.Chart");
dojo.require('dojo.json');
var arYears = getYears();
function swapYears(){
	if(document.getElementById('calYearPicker') != null) {
		var select = document.getElementById('calYearPicker');
		var curValue = select.value;
		var parentx = select.parentNode;
		parentx.removeChild(select);
		select = document.createElement('select');
		select.size = 1;
		select.id = 'calYearPicker';
		select.name = 'calYearPicker';
		parentx.appendChild(select);
	}
	if(select != null) {
	for(x=0;x<100;x++) {
		select.options[x] = new Option(arYears[x], arYears[x], false, false);
	}
	}
}
function getYears() {
	sforce.sessionId = getCookie('sid');
	sforce.connection.sessionId=sforce.sessionId;
	var out = [];
	var currentTime = new Date()
	var year = currentTime.getFullYear()
	try {
		for(x=0;x<100;x++) {
			out[x] = x+year-99;
		}	

	} catch(error) {
		alert(error);
	}
	return out;
}
dojo.addOnLoad(swapYears);
</script>

Credits: Salesforce Community (http://boards.developerforce.com/t5/General-Development/Date-of-Birth-field-Calendar-years-don-t-go-back-before-this/td-p/120133)

Email to Chatter

Alvida … Phir milenge … Good Bye Tata Consultancy Services …

Dear TCS’ers …

Today, 5+ Years of my journey in TCS comes to an end. I would like to personally let you know that today I am leaving my position at Tata Consultancy Services Ltd. I have enjoyed working here and I sincerely appreciate having had the chance to work with you.

Thank you for the support and encouragement you have provided me during my time at TCS. I will miss our interactions and projects we had worked on together.

I would appreciate your continued advice as I start the next phase of my career.

Please keep in touch. Again, thanks so much for your support and keep smiling.

Sometimes it gets very very hard to leave things aside and walk away, as those things have already made a big foot print in your soul.

Best regards,
Chirag

How do I mass-move reports from one folder into another new folder

Problem Statement: We are currently cleaning up our report folders. In order to do so we want to move all unused reports into a ‘quarantene map’ before deleting them. How can we move a large number of reports all at once into one folder? i.e.,

Approach1
In the Eclipse IDE

  • Create a new project
  • Include ‘reports’ or more specifically the report folders you are concerned with
  • Let Eclipse refresh the project with the reports metadata
  • In Eclipse, navigate to the reports folder you just download and then select the Report Folder you want the reports you want to move from, right click and select Properties
  • Take Note of the Location. This is the path where the metadata files are located
  • Open a windows explorer window and navigate to that path
  • Highlight all the Reports you want to move and right click Cut
  • Still in the Window explorer navigate back to the list of report folder and expand the one you want to move the reports to and right click and Paste
  • Now back in the IDE highlight the folder titled Reports and right click and Refresh and then right click again and Force.com>Save to Server
  • BOOM! Now you have moved your reports.

 

Approach2

  • Another alternative would be to edit each report folder on the Report page and move unused reports to the Unfiled Public Reports folder.  You can then move all the reports in your Unfiled Public Reports folder to a new “quarantine” folder.  Yeah I know, still a lot of manual effort.

 

Approach3


Field datatype mapping between Oracle/SQL Server and Salesforce

Over the time I have started developing a tool that pulls salesforce metadata information and creates oracle/sql server “create table” scripts. Isn’t that really awesome!!

The most useful part of the tool is field data type mapping i.e, what data type of salesforce maps to what data type of oracle/sql server. Below is the list of mapping that I used while generating create table scripts – enjoy!!

salesforce data type sql server data type oracle data type
boolean bit varchar2(1)
date smalldatetime date
datetime Datetime date
currency decimal(precision,scale) number(precision,scale)
double decimal(precision,scale) number(precision,scale)
int Int number(10)
picklist nvarchar(255) varchar2(255)
id nvarchar(18) varchar2(18)
reference nvarchar(18) varchar2(18)
textarea nvarchar(max) varchar2(4000)
email nvarchar(255) varchar2(255)
phone nvarchar(255) varchar2(255)
url nvarchar(255) varchar2(255)
textarea nvarchar(max) varchar2(4000)
multipicklist nvarchar(max) varchar2(4000)
anyType nvarchar(max) varchar2(4000)
percent decimal(5,2) number(5,2)
combobox nvarchar(max) varchar2(4000)
base64 nvarchar(max) varchar2(4000)
time nvarchar(255) varchar2(255)
string nvarchar(length) varchar2(length)

 

Apex Visualforce Code Scanning directly in Force.com IDE

A year back Salesforce began supporting source code analysis on Force.com through http://security.force.com/sourcescanner. But there wasn’t any integration with the Force.com IDE.

Checkmarx, the company Salesforce partnered with to provide Force.com source scanning, has stepped up and made an offering available to all of us. For 90 days, for the first 1000 developers, they’ll give away a free version of an Eclipse plugin that can scan all Force.com code (under 100k LoC). The great thing about this is that you get actionable results, directly in your IDE, without having to cross reference line numbers in a report like you have to do today. I hope this is a great resource for all of us!

Download a copy at http://www.apexscanner.com.

Salesforce Ideas Coming in Spring ’11 Release

Is Database.com Dreamforce’10 new baby …

Came acrorss a site Database.com, is that a new baby to be delivered in Today’s Dremaforce’10 conference?

Check this
Database.com
Database.com

Read more @ http://www.database.com/

Facebook Email or FEmail or FMail or Future Email ….?

Are we going to hear something spectacular or something really new n future Email service from Facebook.com? There are lot of speculations on inet about Facebook about to announce it’s email service tomorrow (15 Nov, 2010). Let’s wait and watch.

However there are few interesting facts

  • Facebook has acquired the FB.com domain name. The whois record for the domain name just updated to show Facebook’s name and nameservers for the domain name.
  • Try and send email to “yourprofileid@fb.com” (i.e., chiragmehta84@fb.com), the email doesn’t bounce back
  • mail.facebook.com – prompts you with username and password to login to facebook email – Is it employee email account login or is it future login portal for the public

So there’s something really coming up this Monday, FEmail or FMail or Future Email ….