Start saving time with snippets

February 26th, 2009 No Comments »

One powerful feature of Eclipse and the Force.com IDE that I’ve recently begun using is snippets. When you find yourself writing the same piece of code repeatedly, create a snippet.  I wrote a snippet today to map objects to lists of child objects. This is a task I find myself doing quite often, so it makes sense to have a snippet for it.

To create a snippet in eclipse,  highlight the block of code that you want to create your snippet from and right click it. In the context menu select ‘Add to Snippets..’.  You will then be prompted to select a category for your snippet or create a new one.  After that you are brought into the snippet editor with your chunk of code populated in the ‘Template Pattern’ section. From here you can create variables and put them in your template. After you’ve finished your template click ‘ok’ and your snippet will now be available for resuse.

 To use your snippet you need to have the snippet view on your Eclipse layout. To open the snippet view go to Window > show view > snippets. With the snippet view open, double click on the snippet that you want to use, enter in values for the variables you set and hit insert.  That’s it.

Here is the snippet I wrote today for mapping objects to lists of child objects:


List<${childObjectType}> ${listName} = new List<${childObjectType}>();
Map<Id,List<${childObjectType}>> ${mapName} =
                        new Map<Id,List<${childObjectType}>>();

//TODO: populate ${listName}

for(${childObjectType} childObj : ${listName})
{
	if(${mapName}.containsKey(childObj.${lookupField}))
	{
		List<${childObjectType}> childObjs =
                           ${mapName}.get(childObj.${lookupField});
		childObjs.add(childObj);
		${mapName}.put(childObj.${lookupField}, childObjs);
	}
	else
		${mapName}.put(childObj.${lookupField},
                      new ${childObjectType}[]{childObj});
}

Salesforce.com Data Loader for Linux

February 25th, 2009 2 Comments »

For all the linux salesforce.com users, here’s how you can use data loader on a linux.

First download the hacked version of the data loader that was made by Bluewolf’s own, David Lin

Then follow these directions:

  1. Extract the files to a location of your choice (an ApexDataLoader_12 subdirectory already exists) ie. tar xvzf ApexDataLoader12.tar.gz
  2. In the root of the extracted directory make executable the script that I wrote to call run the jar with the necessary java parameters
    ie. chmod a+x dataloader
  3. Set your JAVA_HOME variable
  4. Run the script(from the directory) and migrate data ie. ./dataloader

Enjoy!

When sorrows come…

February 10th, 2009 No Comments »

I am not a sales person at all, but I am going to pitch you this amazing enhancement from SF.com. 

(It is quite amazing…)

Sales VP’s of the world;  Have you asked yourself lately how I can encourage and easily share knowledge on successful deals without paying a dime in this horrible recession??

Sales rep’s of the world;  Have you ever wonder how your colleague has so many f**&&$% deals won in a given month? (Excuse my French) And how you can reap the benefits, too??

Look no further.  In the coming Spring ‘09 release you will have the competitive edge in winning more businesses. There is going to be a standard SF.com functionality (I know, how can it be from salesforce.com?) where you will be able to “Find(ing) Similar Opportunities”.

What does that mean??

You can easily bookmark  relevant opportunities in SF.com on your deals.  That way, those selfish top dogs will not keep their secret no longer; and to all the Eric Berridge’s in the world (He is our CEO.  I just hope he didn’t trademark his name, because it will be coming out of my pocket real soon),  you will have your resources the tools to bring in more $$ for you.

Footnote * Yes, I am from the digital generation where I grew up typing in symbols rather than actual vocabulary chosen from a conventional English dictionary. *

So, throw away those expensive document management, content management, knowledge management, something management application you’ve been paying and start using “Finding Similar Opportunities” with standard SF.com functionality.  (It’s free, if you didn’t catch that.)

Geez, you think I work for salesforce.com, but I really work for Bluewolf.

 

It’s a related list under Opportunities.  How easy is that??

similaropptyrelatedlist2

 

bookmark2