Force.com IDE productivity boost – “Go to Resource”

My coworker Phil recently showed me a neat little shortcut in the Force.com IDE/Eclipse to quickly go to any file in the workspace with the “Go to Resource” dialog. To enable this shortcut, go to the Force.com IDE menu > Preferences > General > Keys and search for “Go to”. The first result should be “Go to” (this references the “Go to Resource” dialog), which you can assign to a key combo like “⌘G” (this conflicts with the “Go to Address” key combo, so you’ll just need to assign that to a different combo).

The “Go to Resource” dialog does a type-ahead search on all of the files in your workspace, and all you have to do is start typing the name of the file/resource that you’re looking for and hit enter when the right file is highlighted – much faster than hunting through your project folder tree for that class or trigger you need to edit!

Force.com Migration Tool (Ant) out of memory solution

(This is a pretty un-glamorous resuscitation of my blog, but it was fresh on my mind and needed to be shared, so here goes…)

If you try to do a large Salesforce.com metadata deployment using the Force.com Migration Tool (a.k.a Salesforce.com’s Apache Ant extension), then you’ll probably encounter this error:

BUILD FAILED
java.lang.OutOfMemoryError: Java heap space

Thankfully I was able to find the solution to this issue on the DeveloperForce discussion boards with some targeted Googling, but I’m hoping that this post will save others from having to encounter the error in the first place and then hack around for a while figuring out how to implement the fix.

The solution to this problem is pretty basic – all you need to do is to add the parameter “-Xmx1024m” to the “$ANT_OPTS” environment variable in your Ant shell script or batch file. (This parameter raises the maximum memory limit for your Java virtual machine to 1GB, instead of 128MB or whatever paltry amount the default is.) If you’re using the default installation of Ant on Mac OS X, you can find the Ant shell script in the “/usr/share/ant/bin” folder. Open “ant” with any text editor (my favorite is the free app TextWrangler) and go to line 322 of the file. Insert “-Xmx1024m” in between “$ANT_OPTS” and “-classpath”, save the file (you’ll probably need to provide your Mac OS X user account password since it is technically a system file), and you should be all set.

My condolences to the Windows users, as I don’t really use Windows any more, so you’ll have to figure out where that parameter goes. (If someone can post comprehensive instructions for Windows users as a comment, that would be greatly appreciated! I’ll be happy to update this post with the instructions.)

I’m planning to post some more extensive tips and guides on Force.com development and deployment tools (hopefully) in the near future, so please stay tuned!

Salesforce IdeaExchange Contributors Group formed on LinkedIn

A few of us die-hard Salesforce and IdeaExchange users and avid fans have formed a LinkedIn Group to enable us to get better acquainted in “real life”, and we would love to have you join us if you are also a user and contributor to the Salesforce IdeaExchange. Here is the link to request access to the group:

http://www.linkedin.com/groups?gid=2177139

The only thing that we ask is that you send us a link to your IdeaExchange profile/Salesforce Community profile, which would look something like this (updated for the new SFDC Community):

https://sites.secure.force.com/ideaexchange/ideaProfileList?c=09a30000000D9xt&u=00530000003HtZTAA0

You can get to your profile by logging into the IdeaExchange and going to the “My Profile” tab just below the big red “Search” button.

We’ve already started some fascinating and informative discussions in the LinkedIn Group around how & why we participate in the IdeaExchange, and ways that we can improve the community and the Salesforce.com/Force.com platform together.

Hope to see you there!

View All Activities with Comments in Salesforce.com

I’m working on a Salesforce.com SFA CRM implementation that is replacing a Microsoft CRM 3.0, and one of the key things that the users accessed (and heavily relied on) was the Notes view in MS CRM. The Notes view showed the details (subject and comments) of each Note, so the user could see a running narrative of all recent conversations with the customer (they logged all Calls in Notes instead of Activities). The ironic thing was that these notes had been migrated from Salesforce.com SFA Activities (Tasks) several years ago, and I was trying to convince the client to move back to capturing their call notes in Activities/Tasks. However, the standard related list for Activities can’t show the Comments field from the Task/Event objects, so they weren’t too happy about not being able to see the whole narrative in one place. I was about to go down the path of creating a dynamic report link (See “Populate Advanced Filters in a Report from a Custom Link” in Salesforce Help – Solutions), but then I noticed a simple piece of standard functionality that fit the use case perfectly – a simple “View All” button on the Activity History related list:

View All Activity History in Salesforce.com

View All Activity History in Salesforce.com

This provides a nice consolidated view of all Activity History with the Comments field included:

View All Activities Page

View All Activities Page

I wanted to make sure to point out this simple but useful functionality, especially in contrast to Microsoft CRM, so that anyone else out there who might encounter a similar requirement would be aware of it.

All too often we overlook some handy functionality because it is behind a button or a hyperlink, or we form “click habits” that cause us to rush through certain familiar interface paths and ignore existing or new features that could improve our efficiency. While this might spark some good discussions on interface design to overcome these tendencies, I still need to remind myself to not tune out interface elements when looking at a page, because they might just provide the answer I am looking for.

Why can’t I see certain objects in the Apex Explorer?

I’ve had a number of people ask me “Why can’t I see such-and-such an object in the Apex Explorer when I have full rights to view it?” (usually referring to custom many-many/junction objects), and I thought it would be good to get a blog post out there to explain the cause of this phenomenon and how to correct it.

To start with, I should explain what the Apex Explorer is, because many people are not even aware of its existence. The Apex Explorer is a pretty simple .NET desktop application that functions as a sort of SOQL “Query Analyzer” and a Salesforce.com data model browser. You can learn more about it and download a copy from the Force.com developer wiki.

Only one version of the Apex Explorer was ever developed and released, and that is version 8.0. The reason that they gave it that version number was that it’s release coincided with the release of version 8.0 of the Salesforce.com API. The Apex Explorer was somewhat useful and unique at the time, but I’ve found it to be somewhat buggy when you try to use it for anything more than the most basic queries. [The Salesforce Schema Browser in the Ecplise plugin/Force.com IDE is much more robust as it is actively being developed for each new version of the API, so it is highly recommended that you use it for testing SOQL queries and digging into your Salesforce.com schema structure/data model] For some reason lots of people still use the Apex Explorer (and Salesforce still links to it in Setup > Develop > Tools), probably because it is the only light-weight Windows alternative to the incredibly awesome SOQL Xplorer for Mac OS X. (Now why Salesforce won’t link to the actively developed (and very feature rich) SOQL Xplorer from Setup > Develop > Tools or from the Force.com developer wiki is quite a head scratcher, but I digress…)

Salesforce versions the releases of their API so that integrations built on a certain version of the API won’t break when things are added or changed in the API for new releases.  For instance, “Many to Many Object Relationships” were added in the Summer ’08 release (version 13.0 of the API). If you log in with any previous version of the API, you won’t see any Many to Many objects in your schema.

Since the Apex Explorer was created when version 8.0 of the Salesforce API was the current and latest version, it defaults to logging into Salesforce.com with the URL for that version of the API. In order to see new objects in your Salesforce schema that are or have features that weren’t available with version 8.0 of the API, you’ll need to change the login URL that the Apex Explorer uses. Thankfully this is pretty easy to do – open Apex Explorer and go to the Tools menu and select “Options”:

Apex Explorer Tools-Options Menu

In the Options dialog, all you have to do is change the “8.0” to “15.0” on the URL in the “Endpoint” field:

Apex Explorer Options - API v15

And now you will be able to see your “many to many” objects, new standard objects that Salesforce has exposed through the API since version 8.0, and probably anything else in your schema that wasn’t available with version 8.0.

CAUTION: Using a newer version of the API than this application was originally developed for MAY cause certain parts of its functionality to malfunction. I have NOT tested this application thoroughly with any newer versions of the API, so please proceed with caution, and don’t be surprised if something doesn’t work or worse, the data in your Salesforce org gets corrupted somehow. I would highly recommend that you switch to using the Force.com IDE as your schema browser as it is the only officially supported tool for this purpose.

Return the Account Merge wizard to beginning upon completion

A while ago there was an Idea on the IdeaExchange asking if the Account Merge wizard could be returned to the beginning. I responded with a simple workaround, but the comment function of the IdeaExchange wasn’t really suited for providing the solution, so I decided to blog the solution here to make it a little easier to read and find, and also provide a new way to implement the solution.

Basically, the solution is just a simple modification to the URL used to access the Account Merge wizard. Most URLs in Salesforce.com accept a “retURL” querystring parameter that tells the page where to return the user once the operation on the current page (or series of pages) is complete. So, the URL that I came up with for this solution is:

/merge/accmergewizard.jsp?retURL=%2Fmerge%2Faccmergewizard.jsp

The URL lacks any “http://…” because it needs to be relative to your particular Salesforce.com datacenter pod (NA1, NA2, Na3, etc.). Now, the only thing that you really need to do is to take this URL and make a custom link somewhere in your Salesforce org, perhaps on the sidebar or on a page layout, and you’ll have a way to launch the Account Merge wizard set to return to the beginning upon completion. 

However, you’ll probably want to make this solution a little bit more robust and create a custom tab to launch the modified Account Merge wizard. You can create Custom Web Tabs that reference a URL, but if you do this with the URL above you’ll get a second copy of the Salesforce header (tabs, application menu, etc.) under the custom tab. That isn’t very good use of screen real estate (and it is rather confusing to users), so we need to use a little bit of JavaScript magic to redirect the entire browser window to the URL that we’ve created. We can do this by creating an HTML S-control that contains the following code:


<script language="JavaScript">

function redirect()

    {

        parent.parent.frames.location.replace('/merge/accmergewizard.jsp?retURL=%2Fmerge%2Faccmergewizard.jsp');

    }

redirect();

</script>  

Next, create your Custom Web Tab (Setup > Create > Tabs), and choose the “Custom S-Control” Tab Type, and associate it with the Custom S-Control that you created containing the code above. Make the tab visible to the appropriate profiles, and now you have an easily accessible Account Merge Wizard that will cycle back to the beginning upon completion.

For those who want to implement a more future-proof solution (Salesforce is in the process of phasing out S-Controls over the next few years), you can easily implement a VisualForce page that accomplishes the same thing using the following code:


<apex:page >

<script language="JavaScript">

function redirect()

    {

        parent.parent.frames.location.replace('/merge/accmergewizard.jsp?retURL=%2Fmerge%2Faccmergewizard.jsp');

    }

redirect();

</script>

</apex:page>

Then create a VisualForce Tab that references the page you created, and it will work just like the S-control solution above.

This is just one example of how you can use the parameters of the Salesforce URLs (and a little bit of JavaScript magic) to make some helpful modifications to the basic Salesforce functionality. Perhaps in later posts I’ll demonstrate some of the other neat little tricks that you can do with Salesforce URLs, custom links & buttons, and other simple tools.

(My JavaScript in the code above may not be bulletproof, so if you have any issues with the code please let me know and I’ll see if I can find a workaround.)

Why I love Salesforce and the IdeaExchange

Some have asked me why I love Salesforce so much, and why I spend such a great deal of time submitting, commenting, and voting on Ideas on the IdeaExchange.  Here is a list of the primary reasons that motivate me to invest so much in this community:

  • To me, Salesforce.com is one of the most revolutionary platforms ever to come into the information technology marketplace. The power that it gives average users to structure, capture, and analyze data is trule remarkable. It is something that I haven’t seen anyone else match or beat to date.  With every release, the need for writing code to build robust applications is remarkably diminished, and the efficiency with which custom applications can be deployed is also remarkable and unmatched in my experience. I want to help this great platform become even better, and eliminate any obstacles to adoption that I uncover.
  • The IdeaExchange was the first community I ever encountered where it was clearly accessible and encouraged to submit concepts for product improvement to an organization, and easily share those concepts with your peers in the community so that they could promote them as well. I had been looking for an outlet like this for many products that I was passionate about, and discovering the IdeaExchange was tremendously exciting. Salesforce was the first company that I know of to offer a product focused on this amazingly simple but powerful paradigm, and has been the most successful by far in helping other companies implement this model. 
  • I have been privileged to consult with a large number of Salesforce customers, users, and administrators, so I hear a number of unique feature and enhancement requests for the Salesforce.com platform. Most of these people are not ready or interested in participating in the IdeaExchange, so I feel a responsibility to make sure that their Ideas are heard and promoted. Because I spend so much time on the IdeaExchange, I can also give customers and users some insight about what Ideas have already been submitted, and the likelihood or timeframe in which those Ideas might be implemented.
  • Participating in the IdeaExchange (or any Ideas community that has such positive momentum) is increasingly rewarding, as it enables you to connect directly with other users, partners, and product owners that you would likely have never interacted with in other types of communitites. It also gives you a greater sense of ownership in the community, because you are contributing something that the group can objectively identify as valuable. 

I’ve really been amazed at how rapidly the IdeaExchange community has grown and the amount of impact that it has had on the Salesforce.com/Force.com platform. I’m looking forward to seeing how it continues to evolve!

My blogging adventure begins…

I’m already many years late to the party, but I was making some other changes in my life and career and decided that it was a good time to start trying to catch up with my friends and peers by blogging about my passions in technology and business. 

I anticipate that my blog will initially and primarily focus on thoughts, ideas, and experiences related to my work on the Salesforce.com platform, and occaisionally branch out into other topics in the larger world of web application development, technology platforms, and so on.

Thanks for taking the time to stop by, and I hope that you’ll leave a comment if you find something you’re interested in discussing!